[email protected]
[Top] [All Lists]

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

Subject: Re: [Haskell-cafe] Re: ANN: bindings-DSL 1.0.4 Category: FFI
From: Lars Viklund
Date: Fri, 29 Jan 2010 01:34:35 +0100
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 | [email protected]
Haskell-Cafe mailing list
[email protected]

<Prev in Thread] Current Thread [Next in Thread>