
18 Dec
2000
18 Dec
'00
1:40 p.m.
Simon Marlow wrote:
I don't forsee any problems with the C stack - the stack
pointer stays
static during execution of Haskell code, and only moves when we do a C call or return to the RTS.
But how do I get the address of the bottom of the stack ? It seems I can define a C main so I can get the bottom of the stack, but how do I make it call Haskell's main to start the application ?
Well, you could "foreign export" your top-level Haskell function and just call it from C. Check out ghc/includes/RtsAPI.c for the API (you need to call startupHaskell() first and shutdownHaskell() afterward). Sadly we haven't documented this stuff very well. Cheers, Simon