haskell / c2hs

c2hs is a pre-processor for Haskell FFI bindings to C libraries
http://hackage.haskell.org/package/c2hs
Other
199 stars 50 forks source link

Could not get default hook work. #223

Open Magicloud opened 5 years ago

Magicloud commented 5 years ago

{#default out ``Context' [t *] outContext*#}

I got "Something went wrong."

{#default out ``Context' outContext*#}

I got "The phrase `out' is not allowed here."

$ ~/.stack/snapshots/x86_64-linux-tinfo6/lts-12.22/8.4.4/bin/c2hs --version
C->Haskell Compiler, version 0.28.6 Switcheroo, 25 November 2017
  build platform is "x86_64-linux" <1, True, True, 1>
deech commented 5 years ago

Could you post your definitions for Context and the t typedef?

Magicloud commented 5 years ago

t is defined in header as typedef struct _cairo cairo_t;, I have cairo prefix.

Context is defined as

{#pointer *t as Context foreign finalizer destroy newtype#}
outContext :: Ptr Context -> IO Context
outContext = fmap Context . newForeignPtr cairo_destroy