
20 Apr
2010
20 Apr
'10
2:48 a.m.
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 is embedded code for an ECU -- the global variables are sensor and control IO. I'm using Haskell to integrate the C with vehicle models and to provide the user interface. With the help of the SDL hackage lib, I'm able to feed analog and discrete inputs from a gamepad into the simulator, which then runs the embedded code and streams VCD data into GTKWave, providing waveform visualization in realtime. Pretty fun stuff. -Tom