Path: utzoo!attcan!uunet!lll-winken!ames!sgi!kipp@warp.SGI.COM From: kipp@warp.SGI.COM (Kipp Hickman) Newsgroups: comp.lang.c++ Subject: Multiple inclusion of virtual tables... Keywords: virtual tables, cfront Message-ID: <28923@sgi.SGI.COM> Date: 17 Mar 89 21:22:47 GMT Sender: daemon@sgi.SGI.COM Reply-To: kipp@warp.UUCP (Kipp Hickman) Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 24 I implemented a simple hack in our cfront 1.2 compiler as follows to ``solve'' this problem at SGI... In addition to +e0 and +e1, the compiler understands +e where is the name of a class to generate a virtual table for. During the print phase of the compiler, it checks the name against the class name it is printing the virtual tables for. If the name matches, the virtual table is written out global and defined. Otherwise, the table is extern'd. Given that, our Makefile's have something that looks like this: .c++.o: $(C++) +e$* -c $< And then all you have to do is name the source file that implements the class the same as the class (i.e. class Foo in file Foo.c++). A minor side effect is that developers know where to find the implemntation for a particular class without hunting... happy hacking... kipp hickman kipp@sgi.com