another patch for dlopen [was Re: dlopen bug!]
Gary V. Vaughan
gvaughan@oranda.demon.co.uk
Wed Nov 11 18:48:00 GMT 1998
In another thread, I wrote:
>
> [[wrt my previous patch]] Interestingly, this doesn't
> seem to fix my particular problem.
Jorrit Tyberghein wrote:
>
> It seems that dlopen always returns the same handle even if used on
> different dll libraries.
Aha! *That* is my "particular problem" too. A fix is attached. This
is in addition to the previous patch (and the patch from Christian
Jullien).
I forgot to post a ChangeLog entry yesterday, so I have included both
here, and another for Christian's dlsym patch which is attached too.
Cheers,
Gary.
1998-11-11 Gary V. Vaughan <gvaughan@oranda.demon.co.uk>
* dlfcn.cc (get_full_path_of_dll): the static return value
used to be returned unchanged on second and subsequent calls.
It is now correctly reset on each call.
1998-11-10 Christian Jullien <Eligis@wanadoo.fr>
* dlfcn.cc (dlsym): returns a handle to the named symbol in
the loaded executable if a null pointer is passes in for
the module handle.
1998-11-10 Gary V. Vaughan <gvaughan@oranda.demon.co.uk>
* dlfcn.cc (dlopen): returns a handle to the executable if
a null pointer is passed in as the module name.
--- dlfcn.cc.orig Tue Nov 10 11:58:45 1998
+++ dlfcn.cc Wed Nov 11 13:09:55 1998
@@ -139,7 +153,12 @@ dlopen (const char *name, int)
void *
dlsym (void *handle, const char *name)
{
- void *ret = (void *) GetProcAddress (handle, name);
+ void * ret = 0;
+
+ if( handle )
+ ret = (void *) GetProcAddress (handle, name);
+ else ret = (void *) GetProcAddress (GetModuleHandle(), name);
+
if (!ret)
set_dl_error ("dlsym");
debug_printf ("ret %p", ret);
More information about the Cygwin
mailing list