[Haskell-cafe] Re: ANN: bindings-DSL 1.0.4 (Category: FFI)

Lars Viklund zao at acc.umu.se
Thu Jan 28 19:34:35 EST 2010

On Thu, Jan 28, 2010 at 09:36:42PM -0200, Maurí­cio CA wrote:
> > The only thing I've missed for now is a #ccall equivalence
> > for "stdcall" functions, I hacked one up myself and called it
> > #stdcall, but it would be nice to have in the package proper if
> > possible.
> Here is my attempt. I added #callconv macro, that accepts a
> calling convention parameter. The lines below are now equivalent.
> #ccall do_something , CString -> IO CInt
> #callconv do_something , ccall , CString -> IO CInt
> http://bitbucket.org/mauricio/bindings-dsl/downloads

Builds fine here and looks reasonably fine.

> There are a few good C libraries that work well under Linux and
> Windows (libusb1.0 for Windows is in beta now, for instance). Do
> you think we should have a macro that defaults to 'ccall' in Linux
> and others and to 'stdcall' on Windows? If so, I would need some
> help to avoid portability issues (like a list of platforms and
> proper defaults).

I would guess that any libraries that are written to be portable will
likely use the default (cdecl) as calling convention. I do not expect
that one would see stdcall used outside inherently native headers like
the Windows ones, DirectX, etc.

Lars Viklund | zao at acc.umu.se

More information about the Haskell-Cafe mailing list