Subject: Re: function pointers & DLL's
From: Danny Smith <[email-masked]>
To: Andrej Borsenkow <[email-masked]>
Cc: [email-masked]
Date: Sun, 13 May 2001 21:16:51 +1000 (EST)

--- Andrej Borsenkow <[email-masked]> 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