Re: [Haskell-cafe] C variable access via FFI

2010-04-20 Thread John Meacham
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

Re: [Haskell-cafe] C variable access via FFI

2010-04-20 Thread Bertram Felgenhauer
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 impo

Re: [Haskell-cafe] C variable access via FFI

2010-04-20 Thread Bas van Dijk
On Tue, Apr 20, 2010 at 8:48 AM, 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? I bel

[Haskell-cafe] C variable access via FFI

2010-04-19 Thread Tom Hawkins
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? I'm building a simulator for one of our embedded systems. The C i