haskell / c2hs

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

"pointer foreign finalizer fcide" not working #174

Open kolmodin opened 7 years ago

kolmodin commented 7 years ago

Using C->Haskell Interface Version C->Haskell Compiler, version 0.28.1 Switcheroo, 1 April 2016

I'm defining a pointer

data CChannel
{#pointer *channel as Channel foreign finalizer channel_destroy -> CChannel#}

However, the finalizer is only added in {#fun#} declarations in the same file. Fun declarations in other files don't get the finalizer.

The .chi file doesn't mention the finalizer function.

Magicloud commented 5 years ago

I have the same question. I thought the finalizer would be used in default out marshaller. But it is just newForeignPtr_. Unless GHC would call the finalizer itself, I think there is something wrong and has this function correctly working.