[C2hs] help a newbie?

Eric Sessoms nubgames at gmail.com
Thu Feb 22 19:56:00 EST 2007


Thanks, Duncan.

Related to this, for anyone who might run into the same problem, I've
hit several other instances of c2hs refusing to marshal Haskell type
"a" to C type "(a)" that I've worked around by specifying "id" for the
marshal function.  Go figure.  :)  At least it makes sense now that
I've been living with it for a few days.

Followup: is there any way to specify a default marshaller?  For
example, is there a way to specify in one place "always use
withFitsFile* to marshal a FitsFile" (or similar)?

Eric

On 2/22/07, Duncan Coutts <duncan.coutts at worc.ox.ac.uk> wrote:
> On Tue, 2007-02-20 at 20:40 -0500, Eric Sessoms wrote:
> > I'm working on a problem that looks, to my eye, identical to the
> > example in section 2.10 of the documentation
> > http://www.cse.unsw.edu.au/~chak/haskell/c2hs/docu/c2hs-2.html#ss2.10
> >
> > --- cut here ---
> > module Test where
> >
> > #c
> > typedef struct {
> >   int dummy;
> > } fitsfile;
> >
> > int ffclos(fitsfile *fptr, int *status);
> > #endc
> >
> > {# pointer *fitsfile as FitsFile newtype #}
> >
> > {# fun ffclos { `FitsFile', `Int' } -> `Int' #}
> > --- cut here --
> >
> > But running c2hs I get an error message that I haven't been able to make use of:
> >
> > Test.chs:13: (column 17) [ERROR]
> >   >>> Missing "in" marshaller!
> >   There is no default marshaller for this combination of Haskell and C type:
> >   Haskell type: FitsFile
> >   C type      : (FitsFile)
>
> I'm not sure if c2hs is supposed to work out the default marshaler
> automatically, you'd have to ask Manuel, but it does work if you specify
> the marshaler explicitly:
>
> {# fun ffclos { withFitsFile `FitsFile', `Int' } -> `Int' #}
>
> Duncan
>
>


-- 
not about to see your light


More information about the C2hs mailing list