On Thu, Feb 09, 2012 at 11:40:28AM -0800, John Meacham wrote:
> On Thu, Feb 9, 2012 at 11:23 AM, Ian Lynagh <ig...@earth.li> wrote:
> > On Thu, Feb 09, 2012 at 04:52:16AM -0800, John Meacham wrote:
> >>
> >> Since CSigSet has "sigset_t" associated with it, 'Ptr CSigSet' ends up 
> >> turning
> >> into 'sigset_t *' in the generated code. (Ptr (Ptr CChar)) turns into 
> >> char**
> >> and so forth.
> >
> > What does the syntax for associating sigset_t with CSigSet look like?
> 
> There currently isn't a user accessable once,
>
> My current syntax idea is.
> 
> data CFile = foreign "stdio.h FILE"
> 
> but it doesn't extend easily to 'newtype's
> or maybe a {-# CTYPE "FILE" #-} pragma...

I've now implemented this in GHC. For now, the syntax is:

type    {-# CTYPE "some C type" #-} Foo = ...
newtype {-# CTYPE "some C type" #-} Foo = ...
data    {-# CTYPE "some C type" #-} Foo = ...

The magic for (Ptr a) is built in to the compiler.


Thanks
Ian


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

Reply via email to