[Haskell-cafe] Multiple instancing of functions with FFI
Ian Lynagh
igloo at earth.li
Fri Jul 13 09:18:52 EDT 2007
Hi Darrell,
On Mon, Jul 09, 2007 at 05:48:47PM -0700, Lewis-Sandy, Darrell wrote:
> I am having trouble exporting multiple instances of a polymorphic function
> similar to the example in the "Haskell 98 Foreign Function Interface 1.0
> addendum" (page 6). My specific code is below:
Thanks for the detailed bug report!
I've put it in the bug tracker here:
http://hackage.haskell.org/trac/ghc/ticket/1533
milestoned to be fixed in the next release, and also added a test to the
testsuite for it.
> >foreign export stdcall "addByte" (+):: Int8->Int8->Int8
> >foreign export stdcall "addInt" (+):: Int16->Int16->Int16
> >foreign export stdcall "addLong" (+):: Int32->Int32->Int32
In the mean time, as a workaround, you can use
>addByte :: Int8->Int8->Int8
>addByte = (+)
>addInt :: Int16->Int16->Int16
>addInt = (+)
>addLong :: Int32->Int32->Int32
>addLong = (+)
>foreign export stdcall "addByte" addByte :: Int8->Int8->Int8
>foreign export stdcall "addInt" addInt :: Int16->Int16->Int16
>foreign export stdcall "addLong" addLong :: Int32->Int32->Int32
Thanks
Ian
More information about the Haskell-Cafe
mailing list