Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de)
Date: Sun, 13 May 2001 13:43:18 +0400 (MSD)
From: Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
X-X-Sender:  <bor@itsrm2.mow.siemens.ru>
To: Jesper Eskilson <jojo@virtutech.com>
cc: Alan Hourihane <alanh@fairlite.demon.co.uk>, <cygwin@cygwin.com>
Subject: Re: function pointers & DLL's
In-Reply-To: <Pine.WNT.4.33.0105131119550.2408-100000@LEIA>
Message-ID: <Pine.SV4.4.33.0105131338230.23635-100000@itsrm2.mow.siemens.ru>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Sun, 13 May 2001, Jesper Eskilson wrote:

> On Sun, 6 May 2001, Alan Hourihane wrote:
>
> > Everything works fine. But what I'm trying to do is find a way at the linker
> > stage that negates me having to make these __declspec statements. Is there
> > any way this is possible ?
>
> For VC++ (at least) __declspec(dllimport) is purely optional and never
> required. The only this they do is to enable the compiler to skip an
> indirection in the jump and generate a slightly more efficient jump.
>

For GCC (at least :-) __declspec(dllimport) is optional for functions but
is mandatory for variables. The side-effect of the above is, that function
address is no more static and cannot be used as static initializer, e.g.
in function dispatch table like

extern __declspec(dllimport) foo();

static dispatch tbl = {
   ...
   foo,
   ...
}

That is clear, because __declspec(dllimport) basically replaces any
reference to an object by a thunk that returns object's address.

-andrej


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

