On 19/09/2010 16:09, Phil Clayton wrote:
I'm about to start generating code that makes calls to C via the low-level FFI. I was planning to use a form where parameters that provide return values are temporary vols created by alloc, as shown in the example SML code below (as suggested in the C interface documentation). However, it appears that the high-level FFI implementation doesn't do things this way - it uses call_sym_and_convert. Is that more efficient and should I be looking at that?
Hi Phil, It's some time since I looked at this so it would take me a while to re-familiarise with it. I seem to recall, though, that call_sym_and_convert is more efficient since it does all the argument and result conversion in with the foreign function call as a single RTS call. I think with call_sym the arguments need to be converted to vols as separate calls. I wasn't involved in writing this code; it was done by AHL but my impression is that call_sym is only there for backwards compatibility. Regards, David