John Vogel | 19 Dec 03:05
Picon

Re: Foreign C with pointers

Lol, I am surprised that the library even compiled without the "return addr;".

But, this definition is correct:

shiftMyIP :: MyIP -> MyIP
shiftMyIP ip = unsafePerformIO . alloca $ \ptr -> poke ptr ip >> peek (shiftIP ptr)

The other 2 definitions don't even compile.  And since it works I'll try attaching the files.

You can also get the file here:  http://vragon2.googlepages.com/example.zip

Just run the make file to build.
Attachment (example2.zip): application/zip, 13 KiB
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Gmane