_impure_ptr uninitialized in DLLs?
Fifer, Eric
EFifer@sanwaint.com
Wed Jul 12 11:06:00 GMT 2000
>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
More information about the Cygwin-developers
mailing list