replacement of main

mahogny at mahogny at
Sat Dec 6 20:42:18 EST 2003

ok, I guess this is not something you do every day;
I am making a language binding for the library Allegro which has some
weird things going on. I need to make a main() in C.

so I followed the manual, I export my non-main haskell entrypoint
and call it from the C main which basically is copy-paste from the

when I compile everything
> ghc Halleg.hs Game.hs stub.c -L....(additional paths for allegro)...
    -lalleg(a few libs needed) -no-hs-main -o game

I get this cryptic error:
tcLookup: 'main' is not in scope
In the first argument of 'GHC.TopHandler.runIO', namely 'main'
When checking the type of 'main'

why? it seems GHC is ignoring my -no-hs-main and still messing with it.
this is *bad* because what allegro does is to in a weird way rename
main to something platform specific (this is to avoid having a console
in windows, I think it's doing something under unix too)

is there an easy fix to this?

any help appreciated

More information about the Glasgow-haskell-users mailing list