[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Pkg-haskell-maintainers] libffi changes - help needed


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.

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.
 * 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


Joachim "nomeata" Breitner
Debian Developer
  nomeata@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nomeata@joachim-breitner.de | http://people.debian.org/~nomeata

Attachment: signature.asc
Description: This is a digitally signed message part

Reply to: