This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
linking of inline static methods
- To: gcc at gcc dot gnu dot org
- Subject: linking of inline static methods
- From: "Theodore W. Hall" <hall at mariana dot arch dot cuhk dot edu dot hk>
- Date: Tue, 27 Jun 2000 22:05:29 +0800 (HKT)
- Reply-To: twhall at cuhk dot edu dot hk
Greetings.
I'm new to GNU C++ and to Linux. (I'm coming from IRIX). This may
fall under the category of "Interoperation trouble" with the Linux
linker, rather than a strictly GNU C++ compiler bug; I'm not sure.
System:
$ uname -a
Linux vsl01 2.2.12-20 #1 Mon Sep 27 10:40:35 EDT 1999 i686 unknown
$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
Summary:
Dynamically linked classes that declare inline static methods that
access static class variables MUST be compiled with the pragmas:
#pragma interface
#pragma implementation
Without the pragmas, it seems that the static class members are
not properly linked. The main program and the class library see
different addresses for the same symbol.
I'm attaching "TestInlineStatic.tar.gz", which includes the source
and Makefile for a tiny program that demonstrates the problem.
--
Ted Hall
Department of Architecture
Chinese University of Hong Kong
Sha Tin, HONG KONG
Data