Cale Gibbard: > On 11/12/05, Manuel M T Chakravarty <[EMAIL PROTECTED]> wrote: > > You need to tell c2hs to what Haskell type a C pointer type maps before > > it can generate the right signature for the import declaration. This is > > done using a pointer hook: > > > > http://www.cse.unsw.edu.au/~chak/haskell/c2hs/docu/c2hs-3.html#ss3.10 > > > > In your case, you would usually do > > > > {#pointer *Display as Display newtype#} > > > > However, when you use this form, c2hs will generate the newtype > > declaration for you that you import from `Graphics.X11.Xlib.Types' (and > > you would have to cast between your version of `Display' and that of > > `Xlib'). > > I wanted to use the existing types so as to have compatibility with > any other libraries which might use them. It would be a shame if every > Haskell binding to an X library had different, incompatible versions > of the X types, and thus they couldn't be used together.
The darcs version of c2hs darcs get --partial http://www.cse.unsw.edu.au/~chak/repos/c2hs/ now permits the use of a `nocode' keyword at the end of a pointer hook. This suppresses the generation of the type declaration, so you can do {#pointer *Display as Display newtype nocode#} to get what you want. Let me know if there are any problems. Manuel _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
