"static_wrapper" imports in the FFI

Tyson Whitehead twhitehead at gmail.com
Mon Mar 15 20:34:35 EDT 2010

On March 15, 2010 19:54:52 Iavor Diatchki wrote:
> In terms of notation, I like the directness of the "static_wrapper"
> declaration (although not so much the "static_wrapper" name!) because
> it avoids duplication, thus reducing clutter and potential errors.

If it does get accepted, I would propose that adding a new closure form to the 
existing import and export forms might look a bit nicer.  As in

 foreign closure ccall "cname" haskellname :: type

gives you a C function (as you said) of the form

 result cname(arguments ..., HsStablePointer haskellname);

This gets around the non-obviousness of an import also doing an export.

If you didn't want to put the closure in the type, you could also support 
"first cname" and "last cname" (the default) versions to specify where the 
closure should be passed.

Cheers!  -Tyson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20100315/e0afe6b0/attachment.bin

More information about the Glasgow-haskell-users mailing list