Mailing-List: contact cygwin-apps-help AT cygwin DOT com; run by ezmlm Sender: cygwin-apps-owner AT cygwin DOT com List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps AT cygwin DOT com Delivered-To: mailing list cygwin-apps AT cygwin DOT com Message-ID: <3CCAD7F1.2080609@ece.gatech.edu> Date: Sat, 27 Apr 2002 12:55:13 -0400 From: Charles Wilson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2 X-Accept-Language: en-us MIME-Version: 1.0 To: Ralf Habacker CC: Kde-Cygwin , Cygwin-Apps , Binutils Subject: Re: cygwin ld import library issue fix (removing unused "_nm_" symbols) References: <000b01c1ee0a$591e82e0$d36707d5 AT BRAMSCHE> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Ralf Habacker wrote: >>b) build an app that uses that dll, and which accesses both a function >>export and a data export from the dll. >> > > ------------------------------------------------ > $ cat client.cc > ------------------------------------------------ > #include > #include "dll.h" > > main() > { > funcs(); > vars(); > } Except that I'd access 'v0000' *directly* from client.cc; you're not *really* accessing the variable yourself; you're calling a function in the DLL which accesses the variable. However.... > $ make client.exe > g++ -c -o client.o client.cc > g++ -o client.exe client.o -v -Wl,--enable-auto-import -L. -ldll > Warning: resolving _var0000 by linking to __imp__var0000 (auto-import) ^^^^^^^^^^^^^ shows that the linker IS able to resolve the reference (although why it even tried to do so is another questions...) >>c) rebuild the dll using your modified ld. > >>d) does the app still work, without relinking? >> > > $ ./client > printfunc0000 called > v0000=0000 Nice... > e) additional relink app with unmodified ld to see if old ld can handle this > import library > > $ cp /bin/ld.exe.2001_10_03 /bin/ld.exe > > $ rm client.exe > > $ make client.exe > g++ -c -o client.o client.cc > g++ -o client.exe client.o -v -Wl,--enable-auto-import -L. -ldll > Warning: resolving _var0000 by linking to __imp__var0000 (auto-import) ^^^^^^^^^^ Again, it seems to resolve the v0000 import. > $ ./client.exe > printfunc0000 called > v0000=0000 But client doesn't really access the variable directly. > So this seems to work. Cool. --Chuck