[plt-scheme] Interaction between Dr. Scheme and foreign libraries
At Sun, 20 Nov 2005 14:21:21 -0500, Ittai Balaban wrote:
> On Sun, 2005-11-20 at 13:13 -0600, Corey Sweeney wrote:
> > this seems like a hack but have you considered createing a file
> > ".session.lock", and have drscheme remove it uppon every boot. Then
> > have the program load the library if there is no ".session.lock" file,
> > (and after loading it, the program would create the ".session.lock"
> > file).
>
> No, I haven't considered this :)
> Seems this is what I'll have to do, unless I find something in the
> library itself reflecting its initialization state. Thanks.
I'm not sure what you're doing, but there seem to be two good
approaches.
1) if your state is OS-level state that can only be initialized once
per process, do something like what mred does when creating a
connection to the OS's GUI subsystem. It creates the reference once and
uses it multiple times and then is careful that multiple Scheme threads
(etc) access that shared state in a safe manner.
2) if your state can safely be re-initialized, then read about
custodians in the mzscheme manuals (probably you want the insidemz
manual, but I'm not sure) and register the state with the custodian.
Close things down when the custodian is killed, and make new state as
necessary.
In either case, it sounds like your extension is not properly set up to
deal with mzscheme's custodians. If you want to read more about their
design and the philosophy behind it, you probably want to start with
this paper:
http://www.ccs.neu.edu/scheme/pubs/#icfp99-ffkf
and Matthew Flatt may have more/better things to say and/or documents
to point you to.
hth,
Robby
Robby