Re: [Haskell-cafe] c2hs and structs?

2007-08-06 Thread Duncan Coutts
On Sat, 2007-08-04 at 23:59 +0100, Magnus Therning wrote:
> I can't seem to find any information on how to deal with C functions
> that return a (pointer to a) struct.  C2hs tells me there's no automatic
> support for marshalling structs (I'm using version 0.14.5).
> 
> If I'm to do it by hand, is there a preferred way?  (E.g. make the type
> adhere to the type Storable.)

Yes, you want to make it an instance of Storable. You can use c2hs's get
and set hooks to help with this.

Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] c2hs and structs?

2007-08-04 Thread Magnus Therning
I can't seem to find any information on how to deal with C functions
that return a (pointer to a) struct.  C2hs tells me there's no automatic
support for marshalling structs (I'm using version 0.14.5).

If I'm to do it by hand, is there a preferred way?  (E.g. make the type
adhere to the type Storable.)

/M

-- 
Magnus Therning (OpenPGP: 0xAB4DFBA4)
[EMAIL PROTECTED] Jabber: [EMAIL PROTECTED]
http://therning.org/magnus

Unreadable code,
Why would anyone use it?
Learn a better way.
 -- Geoff Kuenning's contribution to the 2004 Perl Haiku Contest,
Haikus about Perl - 'Dishonerable Mention' winner


pgpvEivZj1ap4.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe