Re: [Haskell-cafe] A function callable from C

2007-02-05 Thread John Ky
Actually, what I need to do is a fair bit more complex than string marshalling. It feels like I'll need to pull together a number of different concepts so I may as well describe the problem directly. The C function I want to call is StartServiceCtrlDispatcher: *BOOL* *StartServiceCtrlDispatcher

Re: [Haskell-cafe] A function callable from C

2007-02-05 Thread Stefan O'Rear
On Tue, Feb 06, 2007 at 12:40:38PM +1100, John Ky wrote: > Hi Stefan, > > In that case, how do I marshall [String] to Ptr (Ptr CChar)? look at Foreign.C.String and Foreign.Ptr ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] A function callable from C

2007-02-05 Thread John Ky
Hi Stefan, In that case, how do I marshall [String] to Ptr (Ptr CChar)? Thanks -John On 2/6/07, Stefan O'Rear <[EMAIL PROTECTED]> wrote: You have to use a type that C's tiny brain understains. IANAWP but I'm guessing you want: type ServiceMainClosure = DWORD -> Ptr (Ptr CChar) -> IO () for

Re: [Haskell-cafe] A function callable from C

2007-02-05 Thread Stefan O'Rear
On Tue, Feb 06, 2007 at 12:33:58PM +1100, John Ky wrote: > Hi, > > The following code works: > > >type ServiceMainClosure = DWORD -> IO () > > > >foreign import ccall "wrapper" > > mkServiceMainClosure :: ServiceMainClosure -> IO (FunPtr > ServiceMainClosure) > > But the following doesn't: > >

[Haskell-cafe] A function callable from C

2007-02-05 Thread John Ky
Hi, The following code works: type ServiceMainClosure = DWORD -> IO () foreign import ccall "wrapper" mkServiceMainClosure :: ServiceMainClosure -> IO (FunPtr ServiceMainClosure) But the following doesn't: type ServiceMainClosure = DWORD -> [String] -> IO () foreign import ccall "wrappe