[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cygwin dlopening backends
From: |
Charles Wilson |
Subject: |
Re: cygwin dlopening backends |
Date: |
Mon, 14 Nov 2005 00:21:52 -0500 |
User-agent: |
Mozilla Thunderbird 1.0.6 (Windows/20050716) |
Charles Wilson wrote:
No, I think the wrong-order problem was because of my (now abandoned)
patch when packaging libtool for the cygwin distribution. I *believe*
the current impl, when both loaders are compiled in, calls dlopen first.
But I'll check...
Hmm.
The behavior I see is odd. It seems that the dlopen loader is loaded
first using dlpreopen. Then, the system tries to use the dlopen loader
to load the loadlibrary loader (and that fails). Next, it tries to load
the loadlibrary loader using dlpreopen -- which succeeds.
From that point on, the order (of loaders used to load other,
non-loader, modules), is:
dlpreopen (which fails)
loadlibrary (which succeeds)
dlopen is never used again. This is odd because I can't see any
*single* list structure that would allow this behavior: if new loaders
are prependend to the internal list, shouldn't they always be tried
before preopen? If new loaders are APPended, shouldn't dlopen always
precede loadlibrary?
Unless there are two "lists": one that has the dlpreopen loader (e.g.
"always try this first") and the other that has the dynamically-loaded
loaders. In which case, we still have a problem, because in the
ordinary course of events on cygwin we want dlopen to take precedence
over loadlibrary, and right now the opposite is happening.
FYI, I'm using the attached brute force patch to ltdl.c to investigate
this behavior. Here's the results, from running
"./mdemo.exe ./foo1.la ./libfoo2.la"
Welcome to GNU libtool mdemo!
loader name (dlopen.a): lt_preopen (success)
loader name (loadlibrary.a): lt_dlopen (failure)
loader name (loadlibrary.a): lt_preopen (success)
loader name (libsub.a): lt_preopen (failure)
loader name (libsub.a): lt_loadlibrary (failure)
loader name
(/usr/src/libtool/cvs/libtool-HEAD/_build/tests/mdemo/.libs/cygsub-0.dll):
lt_preopen (failure)
loader name
(/usr/src/libtool/cvs/libtool-HEAD/_build/tests/mdemo/.libs/cygsub-0.dll):
lt_loadlibrary (success)
loader name (foo1.a): lt_preopen (failure)
loader name (foo1.a): lt_loadlibrary (failure)
loader name (./.libs/foo1.dll): lt_preopen (failure)
loader name (./.libs/foo1.dll): lt_loadlibrary (success)
module name: foo1
module filename: ./.libs/foo1.dll
module reference count: 1
** This is foolib 1 **
hello returned: 57616
hello is ok!
cos (0.0) = 1
sub() called
foo1 is ok!
loader name (libsub.a): lt_preopen (failure)
loader name (libsub.a): lt_loadlibrary (failure)
loader name
(/usr/src/libtool/cvs/libtool-HEAD/_build/tests/mdemo/.libs/cygsub-0.dll):
lt_preopen (failure)
loader name
(/usr/src/libtool/cvs/libtool-HEAD/_build/tests/mdemo/.libs/cygsub-0.dll):
lt_loadlibrary (success)
loader name (libfoo2.a): lt_preopen (failure)
loader name (libfoo2.a): lt_loadlibrary (failure)
loader name (./.libs/cygfoo2-0.dll): lt_preopen (failure)
loader name (./.libs/cygfoo2-0.dll): lt_loadlibrary (success)
module name: libfoo2
module filename: ./.libs/cygfoo2-0.dll
module reference count: 1
** This is foolib 2 **
hello returned: 57616
hello is ok!
sin (0.0) = 0
sub() called
foo2 is ok!
loader name ((null)): lt_preopen (success)
myfunc returned: 57616
myfunc is ok!
--
Chuck
Index: ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.236
diff -u -r1.236 ltdl.c
--- ltdl.c 26 Oct 2005 10:26:48 -0000 1.236
+++ ltdl.c 14 Nov 2005 05:19:35 -0000
@@ -367,13 +367,16 @@
while ((loader = lt_dlloader_next (loader)))
{
vtable = lt_dlloader_get (loader);
+ fprintf(stderr, "loader name (%s): %s (", filename, vtable->name);
handle->module = (*vtable->module_open) (vtable->dlloader_data,
filename);
if (handle->module != 0)
{
+ fprintf(stderr, "success)\n");
break;
}
+ fprintf(stderr, "failure)\n");
}
if (!loader)
Re: cygwin dlopening backends, Charles Wilson, 2005/11/13