[gambit-list] multiple main functions!

Ryan Prescott ryan at xlgames.com
Thu Jul 20 18:21:58 EDT 2006


I've perused the archives of the Gambit-C mailing list looking for info
on this issue so I apologize if this is a well known issue.

I've got a C application that I want to use a gambit thread
(actually a termite process). I have a main function defined in C and
a library defined in scheme that I want to init/call from C.

Unfortunately, I get multiple main functions when building and the msvc
linker doesn't like that too much. Being brave, I instructed the linker
to ignore the multiple main error condition and "just use" my C main func.

This does NOT seem to result in a stable situation for the scheme world,
as when I call __setup() I get an exception. Note that the exception is 
handled by the gambit runtime, but there definitely seems to
be some init time badness. The termite process does not respond to 
messages, etc.

I also tried defining ___LIBRARY during C builds to no avail. This did
get rid of the multiple main error, but I still get the exception.

Is there any way to get gambit to not generate a main function? I guess
I was looking for something like chicken's -embedded option. I had some
amount of hope when perusing gambit.h at the -flat option, but I think 
this requires me to resolve functions at startup manually.

(chicken doc reference http://galinha.ucpel.tche.br/Embedding)

FYI I'm building the scheme code with:
	gsc -f -check myfile.scm


More information about the Gambit-list mailing list