foreign export stdcall on user-defined type and function
David Lo
davidlo.mail at gmail.com
Sun Nov 7 21:48:58 EST 2004
Dear all,
I'm new in haskell. I'm assigned to see that a piece of Haskell code
need to be callable from C#. I find that I can convert Haskell to DLL
using ghc --mk-dll.
I find it is fine for simple function but for the following errors are
reported.
foreign export stdcall doComp :: Pattern -> CString -> IO ()
doComp :: Pattern -> CString -> IO ()
foreign export stdcall evalDisplay :: RealFrac a => CString ->
(Int->VMC (Maybe a)) -> IO ()
evalDisplay :: RealFrac a => CString -> (Int->VMC (Maybe a)) -> IO ()
The errors are as follows:
Compiling Main ( CPL.hs, interpreted )
CPL.hs:29:
Unacceptable argument type in foreign declaration:
forall a b c. (Ind a c, Compare c b) => Pat a b
When checking declaration:
foreign export stdcall "doComp" doComp :: Pattern-> CString -> IO ()
CPL.hs:107:
Unacceptable argument type in foreign declaration: {RealFrac a}
When checking declaration:
foreign export stdcall "evalDisplay" evalDisplay :: forall a. (RealFrac
a) => CString-> (Int -> VMC (Maybe a)) -> IO ()
CPL.hs:107:
Unacceptable argument type in foreign declaration:
Int -> VMC (Maybe a)
When checking declaration:
foreign export stdcall "evalDisplay" evalDisplay :: forall a. (RealFrac
a) =>CString-> (Int -> VMC (Maybe a)) -> IO ()
I would like to inquire on how to use foreign function stdcall on self
defined data structure and function. Can I just simply cast them to
string ?
Thank you in advance for your help and attention.
Best Regards,
David
More information about the Glasgow-haskell-users
mailing list