Re: [Haskell-cafe] Haskell DLL crashes Excel

2006-09-25 Thread Lennart Augustsson
Of | Andreas Marth | Sent: 22 September 2006 10:21 | To: haskell-cafe@haskell.org | Subject: [Haskell-cafe] Haskell DLL crashes Excel | | Hi everybody! | | As you might now already know I try to let VBA call Haskell via a DLL. The | function returns a String. Everything works fine now if I call

RE: [Haskell-cafe] Haskell DLL crashes Excel

2006-09-25 Thread Simon Peyton-Jones
L PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of | Andreas Marth | Sent: 22 September 2006 10:21 | To: haskell-cafe@haskell.org | Subject: [Haskell-cafe] Haskell DLL crashes Excel | | Hi everybody! | | As you might now already know I try to let VBA call Haskell via a DLL. The | function returns

Re: [Haskell-cafe] Haskell DLL crashes Excel

2006-09-22 Thread Kyra
Andreas Marth wrote: I solved this with adding C:\WINNT\system32\oleaut32.dll to the files the linker shold link. Was that correct? I prefer "-loleaut32" but see no big difference. Because this dll crashes Excel instantly. I used the code suggested by Esa Ilari Vuokko: newtype BSTR = BSTR CWS

Re: [Haskell-cafe] Haskell DLL crashes Excel

2006-09-22 Thread Andreas Marth
Hi Kyra! First thanks for your repeated responses. I tried to use SysAllocString as suggested by you and Esa Ilari Vuokko. Unfortuntly I get an error: "fake: undefined reference to [EMAIL PROTECTED]" from the linker if I use "stdcall" (wich I think I should use) or fake: undefined reference to `

Re: [Haskell-cafe] Haskell DLL crashes Excel

2006-09-22 Thread Kyra
Kyra wrote: Use SysAllocString... family. Also, remember they (by convention) have to be released from the client side. Oops, "they" = "such allocated BSTRs". Cheers, Kyra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/

Re: [Haskell-cafe] Haskell DLL crashes Excel

2006-09-22 Thread Kyra
Andreas Marth wrote: type BSTR8 = Ptr Word8 createBSTR8 :: String -> IO BSTR8 createBSTR8 s = do let len :: Word32 = fromIntegral (length s) low_l :: Word8 = fromIntegral (len .&. 0x) low_h :: Word8 = fromIntegral (shiftR len 8 .&. 0x) high_l :: Word8 = fromIntegr

[Haskell-cafe] Haskell DLL crashes Excel

2006-09-22 Thread Andreas Marth
Hi everybody! As you might now already know I try to let VBA call Haskell via a DLL. The function returns a String. Everything works fine now if I call the function only once. If I call it more often Excel crashes soon. Does any body have any idea what is going wrong or how I can find out. (I am a