Hello All,
I am creating a Module and getting Function pointer as below in some function.
Function *fn = module->getFunction(fnName);
printf("func Name: %s.\n", fn->getName().str().c_str());
.
.
return (intptr_t) fn;
This prints : “func Name: main.” I convert the ptr to int and return it.
Later I am receiving this as a Func Handler in other function
executeFunction(int funcHandle . .) {
.
.
Function *fn = (Function *) funcHandle;
printf("func Name: %s\n",fn->getName().str().c_str());
gv = executionEngine->runFunction(fn, *args);
.
}
Here it prints an empty string and also the executionEngine->runFunction() gives error : Assertion failed! Expression: GV->hasName() && “Global must have name.”
I am using LLVM-8.0. Please let me know if I am missing out something OR if the procedure is wrong
Best regards,
Manoj