Re: [Haskell-cafe] Why am I not allowed to use CStringLen inforeignexport?

2006-09-23 Thread Brian Hulley
Andreas Marth wrote: low_l :: Word8 = fromIntegral (len .. 0x) low_h :: Word8 = fromIntegral (shiftR len 8 .. 0x) high_l :: Word8 = fromIntegral (shiftR len 16 .. 0x) high_h :: Word8 = fromIntegral (shiftR len 24 .. 0x) Hi - I just noticed the mask should be

Re[2]: [Haskell-cafe] Why am I not allowed to use CStringLen inforeignexport?

2006-09-23 Thread Bulat Ziganshin
Hello Brian, Friday, September 22, 2006, 9:03:01 PM, you wrote: withBSTR8 :: [Char] - (BSTR8 - IO a) - IO a withBSTR8 s f = bracket (createBSTR8 s) (\bstr - free (bstr `plusPtr` (-4))) (\bstr - f bstr) this may be shortened to

Re: [Haskell-cafe] Why am I not allowed to use CStringLen inforeignexport?

2006-09-22 Thread Andreas Marth
usage. Is this needed here? How can it be done? Thanks to everyone who responded, Andreas - Original Message - From: Brian Hulley [EMAIL PROTECTED] To: Andreas Marth [EMAIL PROTECTED]; haskell-cafe@haskell.org Sent: Friday, September 15, 2006 10:07 PM Subject: Re: [Haskell-cafe] Why am I

Re: [Haskell-cafe] Why am I not allowed to use CStringLen inforeignexport?

2006-09-22 Thread Brian Hulley
Andreas Marth wrote: Thanks a lot for this information it helped a lot. Glad to be of help. I am thinking about creating a wikipage about Haskell-VBA interfacing through a DLL. Is it okay for you if I put your code there? Yes. I am a bit concerned about the memory. newArray states that

Re: [Haskell-cafe] Why am I not allowed to use CStringLen inforeignexport?

2006-09-15 Thread Brian Hulley
Brian Hulley wrote: I assume that this means that on 32 bit Windows, the format of a BSTR is: Word16 -- low word of length Word16 -- high word of length Word16 -- first char of string ... The above is not quite correct. It appears from