Mail Archives: cygwin/2003/04/10/02:04:12
I've built a simple DLL as instructed in the user's guide, which
works fine using:
set module = mydll
gcc -c ${module}.c
set old_lib = ${module}.o
set dependency_libs = '-lm'
gcc -shared -o ${module}.dll \
-Wl,--out-implib=lib${module}.dll.a \
-Wl,--export-all-symbols \
-Wl,--export-dynamic \
-Wl,--add-stdcall-alias \
-Wl,--enable-auto-import \
-Wl,--whole-archive ${old_lib} \
-Wl,--no-whole-archive ${dependency_libs}
echo EXPORTS > ${module}.def
nm ${module}.dll | grep ' T _' | sed 's/.* T _//' >> ${module}.def
dlltool --def ${module}.def --dllname ${module}.dll --output-lib ${module}.a
gcc -O -o run_main main.c -L./ -l${module} ${dependency_libs}
./run_main
This also works OK adding -mno-cygwin
...
gcc -shared -mno-cygwin -o ${module}.dll \
...
where printing to a file works fine, but not to stdout which I can live with.
With a more complex well-tested C code, the above script works fine
without "-mno-cygwin," but when I add this in the code bombs, likely due
to the problem being reported:
...
gcc -shared -mno-cygwin -o asadll.dll -Wl,--out-implib=libasadll.dll.a -Wl,--export-all-symbols -Wl,--export-dynamic -Wl,--add-stdcall-alias -Wl,--enable-auto-import -Wl,--whole-archive asa.o asa_usr.o asa_usr_cst.o -Wl,--no-whole-archive -lm
Creating library file: libasadll.dll.a
asa.o(.text+0xede):asa.c: undefined reference to `_impure_ptr'
...
Can anyone suggest what to do about "undefined reference to
`_impure_ptr'"? I want to use these DLL's in another software package,
without having to register (updated) copies of cygwin1.dll, etc.
Thanks.
Lester
--
Prof. Lester Ingber ingber AT ingber DOT com ingber AT alumni DOT caltech DOT edu
www.ingber.com www.alumni.caltech.edu/~ingber
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -