mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-03-15 09:20:23 -07:00
ECL now is capable of detecting whether two calls to dlopen/LoadLibrary/etc returned the same handle.
This commit is contained in:
parent
7fa40e8693
commit
1f20a4a62f
3 changed files with 11 additions and 15 deletions
|
|
@ -55,10 +55,10 @@ ECL 0.9l-p1:
|
|||
|
||||
- SI:LOAD-FOREIGN-MODULE now relies on dlopen/LibraryLoad/... to find the
|
||||
foreign libraries. Nevertheless, duplicate libraries are still identified
|
||||
> (si:load-foreign-module "libm.dylib")
|
||||
#<codeblock "/Users/jjgarcia/src/ecl/build/libm.dylib">
|
||||
> (si:load-foreign-module "/usr/lib/libm.dylib")
|
||||
#<codeblock "/Users/jjgarcia/src/ecl/build/libm.dylib">
|
||||
> (si::load-foreign-module "libm.dylib")
|
||||
#<codeblock "libm.dylib">
|
||||
> (si::load-foreign-module "/usr/lib/libm.dylib")
|
||||
#<codeblock "libm.dylib">
|
||||
|
||||
;;; Local Variables: ***
|
||||
;;; mode:text ***
|
||||
|
|
|
|||
13
src/c/ffi.d
13
src/c/ffi.d
|
|
@ -418,19 +418,10 @@ si_load_foreign_module(cl_object filename)
|
|||
cl_object output;
|
||||
int i;
|
||||
|
||||
filename = si_coerce_to_filename(filename);
|
||||
|
||||
#ifdef ECL_THREADS
|
||||
mp_get_lock(1, ecl_symbol_value(@'mp::+load-compile-lock+'));
|
||||
CL_UNWIND_PROTECT_BEGIN {
|
||||
#endif
|
||||
libraries = cl_core.libraries;
|
||||
for (i=0; i<libraries->vector.fillp; i++)
|
||||
if (cl_stringE(2, libraries->vector.self.t[i]->cblock.name, filename) != Cnil)
|
||||
{
|
||||
output = libraries->vector.self.t[i];
|
||||
goto OUTPUT;
|
||||
}
|
||||
output = ecl_library_open(filename, 0);
|
||||
if (output->cblock.handle == NULL)
|
||||
{
|
||||
|
|
@ -447,9 +438,9 @@ OUTPUT:
|
|||
if (type_of(output) == t_codeblock) {
|
||||
output->cblock.locked |= 1;
|
||||
@(return output)
|
||||
}
|
||||
else
|
||||
} else {
|
||||
FEerror("LOAD-FOREIGN-MODULE: Could not load foreign module ~S (Error: ~S)", 2, filename, output);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,11 @@ ecl_library_open(cl_object filename, bool force_reload) {
|
|||
cl_object libraries = cl_core.libraries;
|
||||
bool self_destruct = 0;
|
||||
cl_index i;
|
||||
|
||||
/* Coerces to a file name but does not merge with cwd */
|
||||
filename = coerce_to_physical_pathname(filename);
|
||||
filename = cl_namestring(filename);
|
||||
|
||||
if (!force_reload) {
|
||||
/* When loading a foreign library, such as a dll or a
|
||||
* so, it cannot contain any executable top level
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue