<div dir="ltr"><div>If the question could be generalized to "how to call the external function without knowing its interface in advance", then the general solution is Foreign Function Interface (FFI). And LLVM's JIT is (at least - was) using FFI for certain things. We faced the same need some time ago, maybe this code can give a rough idea:<br>
<br><a href="http://hpcforge.org/scm/viewvc.php/*checkout*/trunk/src/runtime/HostCall.cpp?root=kernelgen">http://hpcforge.org/scm/viewvc.php/*checkout*/trunk/src/runtime/HostCall.cpp?root=kernelgen</a><br><br></div>- D.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/23 Frank Winter <span dir="ltr"><<a href="mailto:fwinter@jlab.org" target="_blank">fwinter@jlab.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi there! I am trying to figure out how I can call the function returned<br>
by the JIT execution engine. The only circumstance that makes this case<br>
a little problematic is that the function's signature is only available as<br>
runtime state. More precisely the arguments to be passed are only<br>
available as a vector of, e.g.,<br>
<br>
union Types {<br>
void *ptr;<br>
float *ptr_float;<br>
double *ptr_double;<br>
float fl;<br>
int in;<br>
double db;<br>
bool bl;<br>
};<br>
<br>
std::vector<std::pair<int,<u></u>Types> > arguments;<br>
<br>
where the first element of the pair would clearly identify of which type the argument is.<br>
<br>
I thought that I might not be the first having this problem and checked the mailing list<br>
without success.<br>
<br>
Does LLVM has any glue code to call functions returned by the JIT execution engine?<br>
<br>
Or is the only solution in this case to pass the address of the whole vector and let the<br>
jitted function handle everything?<br>
<br>
<br>
Frank<br>
<br>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div>