This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Exporting const variables from DLLs (GCC bug?)


Jon Foster wrote:

> Given this source code: 
> extern const int meaning_of_life __declspec(dllexport);
> const int meaning_of_life __declspec(dllexport) = 42;
> 
> 
> GCC complains: 
> $ c++ -g -O2 -c test.cxx -o test.o
> test.cxx:2: error: external linkage required for symbol 'const int
>    meaning_of_life' because of 'dllexport' attribute
>


It is a bug in gcc.  The above code compiles okay with C, but
strangely, not C++.  For some reason, g++ does not immediately
mark the the definition of global constants as public when they
are defined after a prior declaration.  I have a fix that I will
submit to gcc-patches after reg-testing

Danny

http://personals.yahoo.com.au - Yahoo! Personals
New people, new possibilities. FREE for a limited time.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]