[Haskell-cafe] Re: Haskell DLL crashes Excel
cschmidt at deds.nl
Tue Sep 26 18:16:39 EDT 2006
A few people recently asked how to pass a string between a Haskell DLL
I attach the proof-of-concept code that I wrote a while ago; it
a string from Excel to Haskell and the other way. Most of the C++ code
from code examples at http://msdn.microsoft.com
Beware, though, that the code has never been thoroughly tested. I ran
it, and it did not
crash -- that's almost all I can say. I even do not know if it leaks any
memory. Use it
at your own peril.
The tar file contains a sample Excel sheet, and the sources of two DLLs:
a COM DLL
which interfaces with Excel, and a Haskell DLL which is invoked by the
You will need Visual Studio 7.1 to build the COM DLL.
The Haskell DLL exports one function, hString2String, which takes a
and returns the reverse of it.
To build the Haskell DLL, run build.bat.
To build (and register) the COM DLL, open Excel2Haskell.sln in Visual
Studio, and hit Build.
Once the two libraries are built, open Worksheet.xls and see how the
function is invoked.
Note that the COM DLL can be used not only by Excel, but by any other
program or script that
run by Wscript or
Hope this helps.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 15489 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20060927/416b8e0b/Excel2Haskell.tar-0001.obj
More information about the Haskell-Cafe