Mail Archives: cygwin/2004/08/10/15:49:20
take the underscore out of the dll name
psuedo_stub -> psuedostub
reid
> -----Original Message-----
> From: Peter Ekberg [mailto:peda AT axentia DOT se]
> Sent: Tuesday, August 10, 2004 3:11 PM
> To: cygwin AT cygwin DOT com
> Subject: Re: Dynamic loading of cygwin dependent dlls
>
>
> Christopher Faylor wrote:
> >On Thu, Aug 05, 2004 at 09:09:40AM +0200, Peter Ekberg wrote:
> >>I have read several messages stating that dlopen does not work for
> dlls
> >>that depend on cygwin1.dll.
> >>(e.g. http://sources.redhat.com/ml/cygwin/2004-06/msg01056.html).
> >>I have also understood that this is due to some structures
> not being
> >>initialized in that case.
> >>
> >>Is this dlopen problem limited to non-cygwin apps? I.e. is it true
> >>that an app that depends directly on the cygwin1.dll is
> incapable of
> >>dlopening dlls that depend on cygwin1.dll?
> >
> >No, it is not true. dlopen would be pretty worthless if it
> didn't work
> >in a standard cygwin program.
>
> Indeed. Knowing that it should work, I was inspired to do
> some more tests.
>
> The reason I asked is that the following results in a dll
> that can't be
> dlopened:
>
> foo.c:
> ------------8<---------------
> __declspec(dllexport) int foo(int bar);
>
> int foo(int bar)
> {
> return bar;
> }
> ------------8<---------------
>
> Build commands:
> $ gcc -c foo.c
> $ dlltool --dllname pseudo_stubs.dll --exclude-symbols
> DllMain AT 12,_cygwin_dll_entry AT 12,_cygwin_noncygwin_dll_entry AT 12
,DllMainCR
> TStartup AT 12,DllEntryPoint AT 12 --output-def foo.def foo.o
> $ dllwrap --dllname pseudo_stubs.dll --output-lib
> pseudo_stubs.dll.a --def foo.def foo.o -L/usr/lib
>
> However, further tests have shown that if I change the name
> pseudo_stubs to foo in the above commands, it works like a
> charm. Like this:
>
> $ gcc -c foo.c
> $ dlltool --dllname foo.dll --exclude-symbols
> DllMain AT 12,_cygwin_dll_entry AT 12,_cygwin_noncygwin_dll_entry AT 12
,DllMainCR
> TStartup AT 12,DllEntryPoint AT 12 --output-def foo.def foo.o
> $ dllwrap --dllname foo.dll --output-lib foo.dll.a --def
> foo.def foo.o -L/usr/lib
>
> I use this program to test whether the resulting dll works:
>
> load.c
> ------------8<---------------
> #include <stdio.h>
> #include <dlfcn.h>
>
> char *dlls[] = {
> "pseudo_stubs.dll",
> "foo.dll",
> NULL
> };
>
> int main(void)
> {
> int i;
> void *res;
>
> for(i=0; dlls[i]; ++i) {
> printf("%s\t", dlls[i]);
> res=dlopen(dlls[i], RTLD_LAZY | RTLD_GLOBAL);
> if(!res)
> printf("%s\n", dlerror());
> else
> printf("ok\n");
> }
>
> return 0;
> }
> ------------8<---------------
>
> I build load.c with "gcc load.c -o load" and ./load produces this
> output:
> pseudo_stubs.dll dlopen: Win32 error 998
> foo.dll ok
>
> Any help on this would be appreciated.
>
> Cheers,
> Peter Ekberg
>
>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -