Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!husc6!seismo!elsie!nih-csl!keith From: keith@nih-csl.UUCP Newsgroups: comp.lang.c++ Subject: Re: Questions about C++ Message-ID: <229@nih-csl.UUCP> Date: Wed, 8-Jul-87 17:27:07 EDT Article-I.D.: nih-csl.229 Posted: Wed Jul 8 17:27:07 1987 Date-Received: Sat, 11-Jul-87 17:58:38 EDT References: <227@nih-csl.UUCP> <134@otc.OZ> <2002@druhi.ATT.COM> Distribution: comp Organization: NIH-CSL, Bethesda, MD Lines: 26 Summary: +e option IS a pain to use In article <2002@druhi.ATT.COM>, weh@druhi.ATT.COM (HopkinsWE) writes: > In article <134@otc.OZ>, mikem@otc.OZ (Mike Mowbray) writes: > > In article <227@nih-csl.UUCP>, keith@nih-csl.UUCP (keith gorlen) says: > > > Since using the +e switch is such a pain, I wouldn't recommend this method. > > > > Agreed. > > A simple approach to using the +e option is to use +e0 (only include > external reference to virtual table) for all .c files, and compile > the .h files containing the class declarations using +e1 (generate > globally accessible virtual tables). This won't work on my .h files -- I usually have derived classes. For example, suppose you have a base class B with virtual functions declared in the file B.h and classes D1 and D2 derived from B declared in files D1.h and D2.h, respectively. Now to compile D1.h or D2.h, you must include the declaration of their base class B, so you might as well #include "B.h" in D1.h and D2.h. So if you compile both D1.h and D2.h with the +e1 option both D1.o and D2.o have global definitions of the vtbl for class B. Have I misunderstood something? -- Keith Gorlen phone: (301) 496-5363 Building 12A, Room 2017 uucp: seismo!elsie!nih-csl!keith National Institutes of Health Bethesda, MD 20892