This is the mail archive of the cygwin-developers@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: _impure_ptr uninitialized in DLLs?



>This should be fixed in CVS now.  It will require updating libcygwin.a.

I'm still having problems.  The dlopen() flavor works now, but when
linking against a normal DLL, environ is NULL in the main program.

Here's another demonstration:

d.c:

#include <unistd.h>

int __declspec(dllexport) d()
{
    printf("in d\n");
    printf("environ=%x\n", environ);
}

m.c:

#include <unistd.h>

main(int argc, char **argv, char **envp) {
    printf("envp=%x\n", envp);
    printf("environ=%x\n", environ);
    d();
    printf("environ=%x\n", environ);
}

build:

gcc -g -c d.c
dllwrap --output-lib libd.a --dllname libd.dll d.o
gcc -g -c m.c
gcc -o m m.o -L. -Wl,--Bstatic -ld -Wl,--Bdynamic

run:

envp=a040008
environ=0
in d
environ=a040008
environ=0

Thanks,

Eric Fifer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]