struct and tuples
"Axel Jantsch" <[email protected]> Wed, 21 Jun 2006 16:29:46 +0200
| Newsgroups | gmane.comp.lang.haskell.ffi |
|---|---|
| Organization | Royal Institute of Technology |
| Message-ID | <[email protected]> |
Hi,
I thought I wanted something very simple but just cannot find out how to do it;
I assume I am overlooking something very obvious.
I want to hand over a tuple to a C function and get a tuple back:
type myTup = (Bool, Int)
myFun :: myTup -> myTup
So myFun should be implemented as a C function and I thought I use a struct to
represent the tuple:
typedef struct myStruct { int b; int x; };
struct myStruct myCFun (struct myStruct);
I tried to use c2hs, looked at the documentation of ffi, c2hs, greenCard, hsc2h
s,
the mail archives etc. but I somehow I cannot figure out how to do it.
Do I have to use Ptr? Do I have to make myTup an instance of Storable? Or?
I greatly appreciate any hint!
-- Axel
--
Phone: +46 8 790 4124, Email: [email protected], Web: www.it.kth.se/~axel