On Wed, Apr 04, 2012 at 08:15:31PM +0200, Joachim Breitner wrote: >Hi, > >am I understanding the problem correctly: If one calls a variadic C >function with libffi, one should use ffi_prep_cif_variadic() instead of >ffi_prep_cif(), otherwise bad things may happen. Whether the function is >variadic or not might not be known when looking at the source that calls >ffi_prep_cif(), e.g. in the implementation of the Haskell Foreign >Function Interface.
Correct. >In GHC itself, ffi_prep_cif is called > * in ./rts/Adjustor.c when provding Haskell code to C calls; as Haskell >functions are never variadic, this is not a problem. OK, cool. That should make things much easier. > * in ./compiler/ghci/LibFFI.hsc in the Haskell function >prepForeignCall, called by generateCCall >in ./compiler/ghci/ByteCodeGen.lhs. It seems that this is only relevant >for ghci. > >This seems to imply that normal compiled Haskell code, even code that >uses the Foreign Function Interface, does never call ffi_prep_cif and is >therefore not affected by the problem at hand. Does this sound >plausible? If you're reasonably sure that there's no Haskell code calling C through libffi (just C calling Haskell), then job done. :-) -- Steve McIntyre, Cambridge, UK. [email protected] Into the distance, a ribbon of black Stretched to the point of no turning back -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/[email protected]
