Subject: Re: -mno-cygwin and "undefined reference to `_impure_ptr'"?
From: Lester Ingber <[email-masked]>
To: Ronald Landheer-Cieslak <[email-masked]>
Cc: [email-masked]
Date: Thu, 10 Apr 2003 10:18:58 -0400

Ronald:

Thanks for the direction to use cygcheck.

I had gone back to using '-lm' with mno-cygwin, and this seems to be the
source of pulling in cygwin1.dll, as you first suggested.

I have put in new files
www.ingber.com/private/ASA_DLL.tar.gz
www.ingber.com/private/CYGWIN_DLL.tar.gz
in case other users want to use this approach.

One further question:
Do I need to use dlltool at all?  I am now running:
    ------------8<------------ top cut -> bottom ------------->8------------
set Cfiles = ( asa asa_usr asa_usr_cst )
        gcc -mno-cygwin -o $i.o -c $i.c
end

set module = asadll
set old_lib = " asa.o asa_usr.o asa_usr_cst.o "
set dependency_libs = ''

gcc -shared -mno-cygwin -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 -mno-cygwin -O -o run_main main.c -L./ -l${module} ${dependency_libs}
./run_main
    ------------8<------------ bottom cut <- top ------------->8------------
and this works as well in Excel with and without running dlltool, but I do
not know if other utilities want to also see a .a file.

Thanks.

Lester

On Thu, Apr 10, 2003 at 02:58:09PM +0200, Ronald Landheer-Cieslak wrote:
: Date: Thu, 10 Apr 2003 14:58:09 +0200 (CEST)
: From: Ronald Landheer-Cieslak <[email-masked]>
: To: Lester Ingber <[email-masked]>
: cc: [email-masked]
: Subject: Re: -mno-cygwin and "undefined reference to `_impure_ptr'"?
: In-Reply-To: <[email-masked]>
: 
: On Thu, 10 Apr 2003, Lester Ingber wrote:
: > Under ASA_DLL, a complaint still is made that it cannot find
: > cygwin1.dll? 
: Which means you still linked with the DLL. Did you do what Danny Smith 
: told you to do (i.e. compile everything with -mno-cygwin) and are you 
: *sure* that you're not linking in any other Cygwin-related libraries (most 
: notably libcygwin.a, but you may be linking them in through something 
: else). libg.a is an example of a symlink to libcygwin.a - you're not 
: linking to that, are you?
: 
: Just run cygcheck on your DLL and see if it depends on cygwin1.dll. As 
: long as that is the case, you're linking with something that needs Cygwin 
: - find out what it is and get rid of it :)
: 
: You could always just download MinGW (from www.mingw.org) and try 
: compiling in the MSYS environment. MSYS is a Cygwin fork but the mingw 
: compiler doesn't stick in the cygwin dependencies by default.
: 
: HTH
: 
: rlc
: 

-- 
 Prof. Lester Ingber  [email-masked]  [email-masked]
 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/