Displaying 2 results from an estimated 2 matches for "capi_test".
Did you mean:
c_api_test
2017 Jan 26
2
mcjit C interface problems
Thanks for the tip - getting closer:
$ ./capi_test 5 6
args[0]: 5
args[1]: 6
result: 4294959200
Here's the code I changed:
printf("args[0]: %d\n", (int)LLVMGenericValueToInt(args[0], 0));
printf("args[1]: %d\n", (int)LLVMGenericValueToInt(args[1], 0));
uint64_t (*func)();
func = (uint64_t (*)())LLVMGetFunctionAddr...
2017 Jan 25
2
mcjit C interface problems
...MDumpModule(mod);
// Write out bitcode to file
if (LLVMWriteBitcodeToFile(mod, "sum.bc") != 0) { fprintf(stderr, "error
writing bitcode to file, skipping\n"); }
LLVMDisposeBuilder(builder);
LLVMDisposeExecutionEngine(engine);
}
Here's what I see when I run it:
$ ./capi_test 5 6
args[0]: 5
args[1]: 6
result: 5
; ModuleID = 'my_module'
source_filename = "my_module"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define i32 @sum(i32, i32) {
entry:
%tmp = add i32 %0, %1
ret i32 %tmp
}
It seems to fail to add, and always return...