Hi Reid,<br>If an argument is a pointer and the function changes the value it pointed to,<br>do you know how to get that updated value after executing the wrapper function?<br><br>Thanks.<br>Vu<br><br><div class="gmail_quote">
On Tue, Jan 11, 2011 at 2:40 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:reid.kleckner@gmail.com">reid.kleckner@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">On Tue, Jan 11, 2011 at 1:41 PM, Vu Le <<a href="mailto:vmle@ucdavis.edu">vmle@ucdavis.edu</a>> wrote:<br>
> Hi,<br>
> I want to implement a tool that probes a function with several input and<br>
> records all the return output.<br>
> The function might have more than 1 return value (by reference parameters).<br>
><br>
> Does ExecutionEngine::runFunction() support function call with complex<br>
> argument type?<br>
> If not, I guess that I have to create a wrapper function, prepare all the<br>
> data, and call the original function.<br>
> Am I on the right track?<br>
<br>
</div></div>For functions with complicated parameters and return values,<br>
runFunction will generate a wrapper function that calls the function<br>
with the right arguments.  This is fairly expensive and leaks memory<br>
if called more than once for the same function.  If the type of the<br>
function is known, you can just use getPointerToFunction, cast that,<br>
and call it from C.<br>
<br>
If it's not known but you want to call it many times with different<br>
arguments, you could generate a wrapper function responsible for<br>
unpacking your own datastructure describing the arguments and calling<br>
the function you are testing with those arguments.  Seems like you are<br>
on the right track there.<br>
<font color="#888888"><br>
Reid<br>
</font></blockquote></div><br>