<div dir="ltr"><p style="border:0px;color:rgb(218,215,209);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">Hello All,</p><p style="border:0px;color:rgb(218,215,209);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">I am creating a Module and getting Function pointer as below in some function.</p><pre style="background-color:rgb(29,31,32);border:0px;white-space:pre-wrap;color:rgb(218,215,209);font-style:inherit;font-variant:inherit;font-weight:inherit;margin-top:0px;margin-bottom:1em;padding:12px 8px;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-radius:3px"><code style="border:0px;margin:0px;padding:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit">Function *fn = module->getFunction(fnName);
printf("func Name: %s.\n", fn->getName().str().c_str());
.
.
return (intptr_t) fn;
</code></pre><p style="border:0px;color:rgb(218,215,209);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">This prints : "func Name: main." I convert the ptr to int and return it.</p><p style="border:0px;color:rgb(218,215,209);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">Later I am receiving this as a Func Handler in other function</p><pre style="background-color:rgb(29,31,32);border:0px;white-space:pre-wrap;color:rgb(218,215,209);font-style:inherit;font-variant:inherit;font-weight:inherit;margin-top:0px;margin-bottom:1em;padding:12px 8px;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-radius:3px"><code style="border:0px;margin:0px;padding:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit">executeFunction(int funcHandle . .) {
.
.
Function *fn = (Function *) funcHandle;
printf("func Name: %s\n",fn->getName().str().c_str());
gv = executionEngine->runFunction(fn, *args);
.
}
</code></pre><p style="border:0px;color:rgb(218,215,209);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">Here it prints an empty string and also the executionEngine->runFunction() gives error : Assertion failed! Expression: GV->hasName() && "Global must have name."</p><p style="border:0px;color:rgb(218,215,209);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">I am using LLVM-8.0. Please let me know if I am missing out something OR if the procedure is wrong</p><p style="border:0px;color:rgb(218,215,209);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">Best regards,</p><p style="border:0px;color:rgb(218,215,209);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both"><span style="font-family:inherit;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit">Manoj</span></p></div>