Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <20010513111651.20656.qmail@web6405.mail.yahoo.com> Date: Sun, 13 May 2001 21:16:51 +1000 (EST) From: =?iso-8859-1?q?Danny=20Smith?= Subject: Re: function pointers & DLL's To: Andrej Borsenkow Cc: cygwin AT cygwin DOT com In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit --- Andrej Borsenkow wrote: > On Sun, 13 May 2001, Jesper Eskilson wrote: > 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 > > Yes, and this is relevant to an apparent bug I reported earlier (with a suggested fix) regarding static const initialisation in imported C++ classes. http://sources.redhat.com/ml/cygwin/2001-03/msg01706.html Static const members (whether they are initialised inline or not) "inherit" the __declspec(dllimport) status of their class. If they are initialised inline the automatic use of context to mark as dllimport causes a failure later on when gcc says no, no you can't import initialised objects. Danny _____________________________________________________________________________ http://messenger.yahoo.com.au - Yahoo! Messenger - Voice chat, mail alerts, stock quotes and favourite news and lots more! -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple