On 4-Mar-09, at 11:30 AM, David St-Hilaire wrote:
Hello all!
I was wondering why the gambit interpreter complains about loading multiple times an object file (i.e. a compile .o1 file). It is pretty annoying not being able to reload a file that loads its required modules... :(
.o1 files can't be loaded more than once due to an OS limitation. A .o1 file is a dynamically loadable shared lib (a "DLL" in Windows speak) and many operating systems don't allow them to be loaded more than once.
What should I do instead? Load the requirements manually in the repl? This is not very convienient :( I could also just load the source file (load "module.scm") instead of the object file (load "module") but I would not benefit of compiled code perf...
It depends what you want to do... Why do you load them more than once? It can't be because the code has changed, because a different version (i.e. .o2, .o3, ...) would have been generated and then **you can** load the code more than once. Perhaps you have an initialization (in the Scheme code) that you want to redo because you have mutated the binding after loading the file. Perhaps you can abstract the initialization in a function and then call that function to do the initialization. You could write your own version of load, call it my-load, which keeps a table of what has been loaded and avoid calling load on those files that are in the table, instead calling the init function whose name would be derived from the file name.
In other words its your problem!
Marc