Re: atexit in modules

2008-11-16 Thread Ludovic Courtès
Hello, Mike Gran <[EMAIL PROTECTED]> writes: > Idea 1 was to wrap as library_init() as a scheme function that gets > called when the scheme module is loaded, and then wrap library_end() > as a scheme function that gets called when the module is unloaded. > But, modules are never unloaded. Yeah,

Re: atexit in modules

2008-11-15 Thread Mike Gran
> 2008/11/14 Mike Gran : > > > > So I'm back to the idea of creating a module-level variable that exists > > while > > the module is in memory, and then calling library_end() when that variable > > is > > GC'd. But I can make it more schemey by using guardians and after-gc-hook > > as > >you

Re: atexit in modules

2008-11-15 Thread Neil Jerram
2008/11/14 Mike Gran <[EMAIL PROTECTED]>: > > So I'm back to the idea of creating a module-level variable that exists while > the module is in memory, and then calling library_end() when that variable is > GC'd. But I can make it more schemey by using guardians and after-gc-hook as > you sugges

Re: atexit in modules

2008-11-13 Thread Mike Gran
> - Original Message > > From: Ludovic Courtès [EMAIL PROTECTED] > > > In theory, the Right Way(tm) would be to register a finalizer for the > > module that does `load-extension'.  That can be done using a guardian, > > but the guardian the needs to be called once in a while, e.g., in > >

Re: atexit in modules

2008-11-13 Thread Mike Gran
- Original Message > From: Ludovic Courtès [EMAIL PROTECTED] > In theory, the Right Way(tm) would be to register a finalizer for the > module that does `load-extension'.  That can be done using a guardian, > but the guardian the needs to be called once in a while, e.g., in > `after-gc-h

Re: atexit in modules

2008-11-13 Thread Ludovic Courtès
Hello, Mike Gran <[EMAIL PROTECTED]> writes: > I have a C library that I wrapped as gsubrs that get put into a Guile > module. The C library wants a library_init() function called when it > is initialized and a library_end() function called when it taken down. > > (for the curious, it is specifi