[Ecls-list] library loading in Windows, again
Dustin Long
dlong at stevens.edu
Wed Jun 20 04:45:58 UTC 2007
The last patch for loading libraries, which copied each load target to a
temporary location first, has introduced some other problems (for
Windows only). In some cases, when loading the same library multiple
times, one wants only a single copy to actually be instantiated. For
example, when using ffi to connect to a foreign library, loading
multiple copies will cause problems since each library will get their
own set of instance data, rendering separate ffi:def-functions
incompatible with each other.
I propose the following solution. When a library is loaded by
ecl_library_open, check first if the file's modified time is newer than
the already loaded library's. If so, continue with loading, otherwise
return the already loaded codeblock. It's not very elegant, but works
pretty well. Maybe the code should be refactored though, perhaps making
file-date-comparing a separate function.
Along with the patch, test code is attached (getset.cpp is a dll,
usage.lisp an ffi client)
Before patching: (progn (set-value 3) (get-value)) => 0
After patching: (progn (set-value 3) (get-value)) => 3
Another thing I noticed was that during ecl_library_open, a codeblock's
name is assigned the value of the filename loaded, even when that file
first gets copied to a temp. This doesn't seem right, as what really
needs to be tracked is the original library path. The attached patch
also fixes this. There aren't any adverse side effects from this change,
are there?
Dustin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 04_2007-06-09-load-time.patch
Type: text/x-patch
Size: 1307 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20070620/125d4514/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: usage.lisp
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20070620/125d4514/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: getset.cpp
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20070620/125d4514/attachment-0001.ksh>
More information about the ecl-devel
mailing list