[Haskell-cafe] FFI and Excel VBA

Lewis-Sandy, Darrell darrelll at amgen.com
Tue Jun 19 11:57:05 EDT 2007

I am new to using the Haskell FFI, and have been trying to implement the
example in section 11.6 of the GHC user's guide.  


I have finally gotten to the point where my dll compiles (there is a missing
space in the mainDll.h code at line 4:12) using GHC 6.6.1, and used the
declare statement to expose the "adder" function in Excel VBA.  My VBA Code
is given below:


Private Declare Function adder Lib " adder.dll" Alias "adder at 8" (ByVal x As
Integer, ByVal y As Integer) As Integer


Private Sub test()

Debug.Print adder(1, 2)

End Sub




My problem is this:

The function works fine (the immediate window displays 3), but when I
terminate Excel, I get an application error ("The instruction at ...
referenced memory at ... . The memory could not be read.").  Does anyone
else have any experience calling Haskell from VBA that might be relevant?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070619/3c1c0853/attachment.htm

More information about the Haskell-Cafe mailing list