This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: function pointers & DLL's
- To: Andrej Borsenkow <Andrej dot Borsenkow at mow dot siemens dot ru>
- Subject: Re: function pointers & DLL's
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- Date: Sun, 13 May 2001 21:16:51 +1000 (EST)
- Cc: cygwin at cygwin dot com
--- Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> 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