So for each module (or Scheme library) I have in my project I have to do a separate ___setup? I guess if I compile all my libraries into a single standalone executable the ___setup step is no longer required.

--Vijay

On Fri, Nov 13, 2015 at 9:10 PM, Marc Feeley <dr.marc.feeley@gmail.com> wrote:
The structure “setup_params” contains parameters for the runtime system (e.g. the system version number, the size of the heap, the default character encoding for I/O, the debugging level).  And it also contains the program’s “linker”, a function which represents the set of Scheme modules that are part of the program.

A call to ___setup_params_reset will give default values to all the parameters in setup_params.  Then the parameters in setup_params that don’t have a default value are set explicitly with assignments (here the “version” and the “linker”).

The call to ___setup is what starts the execution of the Scheme code.  It uses the parameters in setup_params to allocate the heap, the stack, the symbol table, etc.  Then it executes sequentially each module of the program.  When ___setup returns, the Scheme code is finished executing.  Note that it is still possible after that to call Scheme functions defined with c-define.  Finally a call to ___cleanup reclaims the heap and other resources that were allocated by ___setup.

Marc


> On Nov 13, 2015, at 9:48 AM, Vijay Mathew <vijay.the.lisper@gmail.com> wrote:
>
> I found this code in examples/pthread/pthread.c:
>
>  ___setup_params_struct setup_params;
>
>   ___setup_params_reset (&setup_params);
>
>   setup_params.version = ___VERSION;
>   setup_params.linker  = SCHEME_LIBRARY_LINKER;
>
>   ___setup (&setup_params);
>
> What does ___setup_params_reset and ___setup do?
>
> Thanks,
>
> --Vijay
> _______________________________________________
> Gambit-list mailing list
> Gambit-list@iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list