The support libraries for HaskellDirect provide
functions for converting between BSTRs and Haskell'
String (Com.marshallBSTR, Com.unmarshallBSTR) --
http://www.dcs.gla.ac.uk/fp/software/hdirect/user-32.html
has the overview. However, the binaries available for
that library is for ghc-4.045, so you'd have to compile
them up yourself for ghc-4.08.
To build a 'static' DLL, here's what you need to do:
- compile up all your Haskell code using -static.
- write a .def file containing the entry points you
want to expose. In my example, the .def file would
just contain:
EXPORTS
adder@8
- link the static DLL:
ghc-4.05 -static --mk-dll -optdll--def=adder.def \
-o adder.dll adder.o dllMain.o -lHSrts
I heard some rumours that -static might disappear. If that's
the case, I think that would be unfortunate.
--sigbjorn
Christian Lescher <[EMAIL PROTECTED]> writes:
>
> Thank you for your detailed answer - it's really great, it works! :-)
>
> However, I have got one more problem: the function I want to
> call from VBA is of
> type String -> String -> String
> Is there a (simple) method to convert VBA strings (BSTR) to
> Haskell's [Char] and
> vice versa?
>
> By the way: Is it possible to build DLLs that do not depend
> on GHC's runtime DLLs?
> I tried out the "-static" option like for compiling EXEs, but
> it didn't work.
>
> CL
>
>