[gambit-list] Embedding Gambit as a dll.

Alex Sandro Queiroz e Silva asandroq at gmail.com
Thu Oct 23 07:23:47 EDT 2008


Hallo,

Neil Baylis wrote:
> 
> Is it possible to do this with Gambit? The crux of the problem is that
> the scheme code cannot declare main(). Instead, it needs to provide an
> init function and a deinit function. My plugin would call the init
> function when it loads, and the deinit function when it unloads. There
> is no stdin or stdout. When the plugin is operating, iTunes will
> repeatedly call a single function, lets call it the work function.
> 

     Although it is only mentioned in passing in the manual, Gambit is
very suited to embedding. Take a look at the pthreads example in the
source distribution. Basically:

1. Your init function will call ___setup(), you can set several
initialisation parameters in the parameters struct, such as character
encoding, debugging, behaviour on errors etc.,

2. Your deinit function will call ___cleanup(),

3. You must compile the C files generated by Gambit with the ___LIBRARY
preprocessor directive.

Hope this helps,
-alex
http://www.ventonegro.org/



More information about the Gambit-list mailing list