I was wondering whether there was any standard way to find HsFFI.h? I can hardcode it into my makefiles for my own projects, but when i distribute code, I end up having to add -I lines for every possible location of it, usually multiplied by every compiler version it supports since that is often also in the path name. (and no, hmake is not really an option. pure make is my tool). perhaps some option to the haskell compiler which spits out the appropriate flags to pass to the C compiler.
If you're using GHC, the trick is to use GHC to compile your C code too because it adds the appropriate -I flag to the gcc command line. If this isn't possible, then you can extract the information from the output of 'ghc -v'. The relevant directory is in the include_dirs field of the rts package. Cheers, Simon
On Wed, Oct 30, 2002 at 09:12:01AM -0000, Simon Marlow wrote:
If this isn't possible, then you can extract the information from the output of 'ghc -v'. The relevant directory is in the include_dirs field of the rts package.
michaelw@stargate:~$ ghc --print-libdir /usr/lib/ghc-5.04.2 michaelw@stargate:~$ so: GHC_INCLUDES := $(shell ghc --print-libdir)/include might help. Cheers, M/
John:
I was wondering whether there was any standard way to find HsFFI.h?
Simon:
If you're using GHC, the trick is to use GHC to compile your C code too because it adds the appropriate -I flag to the gcc command line.
And if using Hugs (forthcoming release), use ffihugs to compile your C code: Foo.so: Foo.hs foo.c bar.o ffihugs +G Foo.hs -L"foo.c" -L"bar.o" -L"-lm" You'll also find the file in ${installdir}/lib/hugs/include/HsFFI.h -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/
participants (3)
-
Alastair Reid -
Michael Weber -
Simon Marlow