From: Danny S. <dan...@cl...> - 2003-03-03 10:02:16
|
Variations of this bug have been reported several times to the GCC GNATS database IMO, opinion the real bug is that GCC doesn't warn that the code contains inconsistent dllimport attribute. The dllimport attribute means that the variable is defined externally in a dll library, not later in the same translation unit. ----- Original Message ----- From: "Wu Yongwei" <ad...@ne...> To: "mingw-users" <min...@li...> Sent: Monday, 3 March 2003 09:30 Subject: [Mingw-users] A bug of GCC 3.2.2 concerning dllimport and data definition > --- test.cpp begins --- > extern __declspec(dllimport) int SomeValue; > > static void test() > { > SomeValue; // Any kind of access to it > } > > int SomeValue = 0; > --- test.cpp ends --- > > $ g++ -c test.cpp > $ nm -C test.o > 00000000 b .bss > 00000000 d .data > 00000000 t .text > 00000000 t test() > 00000000 D D > > Comment line 5 and the result is correct: > $ nm -C test.o > 00000000 b .bss > 00000000 d .data > 00000000 t .text > 00000000 t test() > 00000000 D SomeValue > > With GCC 2.95 the result is always correct: > $ nm -C test.o > 00000000 b .bss > 00000000 d .data > 00000000 t .text > 00000000 t __gnu_compiled_cplusplus > 00000000 D SomeValue > 00000000 t test(void) > 00000000 t gcc2_compiled. > > Code was adapted from real project code (I was testing GCC 3 with my own > projects), the variable declaration and function definition was really > in an header file, and the value definition was in a .cpp file used to > build a DLL, which includes the header file. To my surprise, I found > the resulting DLL was missing the variable! > > Best regards, > > Wu Yongwei > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users |