delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2002/04/27/12:52:53

Mailing-List: contact cygwin-apps-help AT cygwin DOT com; run by ezmlm
Sender: cygwin-apps-owner AT cygwin DOT com
List-Subscribe: <mailto:cygwin-apps-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-apps/>
List-Post: <mailto:cygwin-apps AT cygwin DOT com>
List-Help: <mailto:cygwin-apps-help AT cygwin DOT com>, <http://sources.redhat.com/lists.html#faqs>
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 <cwilson AT ece DOT gatech DOT edu>
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 <Ralf DOT Habacker AT freenet DOT de>
CC: Kde-Cygwin <kde-cygwin AT kde DOT org>, Cygwin-Apps <cygwin-apps AT cygwin DOT com>,
Binutils <binutils AT sources DOT redhat DOT com>
Subject: Re: cygwin ld import library issue fix (removing unused "_nm_" symbols)
References: <000b01c1ee0a$591e82e0$d36707d5 AT BRAMSCHE>

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 <stdio.h>
> #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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019