Static library to redefine entrypoint

Philip K.F. Hölzenspies p.k.f.holzenspies at utwente.nl
Fri Apr 24 07:27:08 EDT 2009


On Fri, 2009-04-24 at 13:06 +0200, Krzysztof Skrzętnicki wrote:
> Why not just tell them to import your library and do something like 
> > main = withSomeInit labMain
> where "withSomeInit" is the function you provide? This approach is
> present in some other libs that require initialization.

Dear Christopher,

I know there are alternatives and I know some people use them. A
particular problem I have now, though, is SDL. On OS X, the SDL library
defines an alternative entry-point to the application, called SDL_main,
where the libSDL.a provides a main (insert long story about Cocoa
frameworks and Objective-C linking here). I don't particularly like this
method, but it's the world I have to work with. Also, many alternatives
to SDL don't play nice with GHCi, which is particularly useful for lab
teaching. If I can somehow introduce my own new entry point, I could
also wrap GHCi in something else quite easily (I know I could wrap GHCi
as it is, but it would be even nicer if I could just link to the
binary).

I figured this level of detail would distract form the question, though
and I would run the risk that people would try to solve my SDL linking
woes, which is not the point of the question.

Regards,
Philip



More information about the Glasgow-haskell-users mailing list