This is the mail archive of the
cygwin-developers@sources.redhat.com
mailing list for the Cygwin project.
RE: _impure_ptr uninitialized in DLLs?
- To: "'cygwin-developers at sourceware dot cygnus dot com'" <cygwin-developers at sourceware dot cygnus dot com>
- Subject: RE: _impure_ptr uninitialized in DLLs?
- From: "Fifer, Eric" <EFifer at sanwaint dot com>
- Date: Wed, 12 Jul 2000 19:03:07 +0100
>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