Profiling makes FFI Marshalling of Doubles and Int64s fail

Bayley, Alistair Alistair_Bayley at ldn.invesco.com
Wed Sep 15 05:20:15 EDT 2004


Thanks, including the header does fix it. I was lazy, as you can link quite
easily against a DLL without having to provide a header; just the import
decls suffice, plus -l and -L directives. I have had this problem (not using
the -I directive) in a different guise, when trying to optimise.

I've added the header to the foreign import decls e.g. foreign import
"sqlite.h sqlite3_open" ... I left it out earlier because this version of
the Sqlite library ships just as a DLL, with no accompanying header. I
downloaded the source and found one I could use (I *hope* it's the right
one), but it does make you wonder what C (and other) programmers who want to
use the library are expected to do...

Alistair.


-----Original Message-----
From: Roberto Zunino [mailto:zunino at di.unipi.it] 

<snipped>

AFAICS, it seems as the asm code generator knows about the Haskell types 
and therefore knows how to fetch the bits correctly, while the via-C 
code generator simply uses the C function calls (without prototypes), so 
functions return types are defaulted to int.

Also, you can try adding -Wall and see if the C compiler warns about 
this (mine does).

The GHC user's guide (section 8.2.2) is also insightful. It seems that 
using C headers is pretty much required, or, as the guide itself says, 
"You're crazy not to do it". ;-)

Regards,
Roberto Zunino.

-----------------------------------------
*****************************************************************
Confidentiality Note: The information contained in this 
message, and any attachments, may contain confidential 
and/or privileged material. It is intended solely for the 
person(s) or entity to which it is addressed. Any review, 
retransmission, dissemination, or taking of any action in 
reliance upon this information by persons or entities other 
than the intended recipient(s) is prohibited. If you received
this in error, please contact the sender and delete the 
material from any computer.
*****************************************************************



More information about the Glasgow-haskell-users mailing list