On Tue, Apr 20, 2010 at 01:48:16AM -0500, 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, or must I write a > bunch of C wrapper functions for the interface, i.e. a 'get' and a > 'set' for each variable?
Yup. foo.c: int my_int; Foo.hs: foreign import "&my_int" my_int_ptr :: Ptr Int foo = do poke my_int_ptr 4 x <- peek my_int_Ptr John -- John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/ _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe