From axel at kth.se Wed Jun 21 10:29:46 2006 From: axel at kth.se (Axel Jantsch) Date: Wed Jun 21 10:21:19 2006 Subject: struct and tuples Message-ID: <200606211429.k5LETnJF018733@bee.imit.kth.se> 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: axel@kth.se, Web: www.it.kth.se/~axel