20 Apr
2010
20 Apr
'10
6:13 a.m.
Tom Hawkins wrote:
I have a bunch of global variables in C I would like to directly read and write from Haskell. Is this possible with FFI,
Yes it is, as explained in section 4.1.1. in the FFI specification [1]. An import for a global variable int bar would look like this: foreign import ccall "&bar" bar :: Ptr CInt The difference to an import of a function int foo() is the extra "&". HTH, Bertram [1] http://www.cse.unsw.edu.au/~chak/haskell/ffi/ffi/ffise4.html#x7-170004.1.1