[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Fwd: Re: Reducing the number of conflicts in libraries
From:       Lubos Lunak <l.lunak () sh ! cvut ! cz>
Date:       2001-09-17 20:05:26
[Download RAW message or body]

----------  Předaná zpráva  ----------

Subject: Fwd: Re: Reducing the number of conflicts in libraries
Date: Mon, 17 Sep 2001 15:56:13 -0400
From: "Christophe Prud'homme" <prudhomm@MIT.EDU>
To: Lubos Lunak <l.lunak@sh.cvut.cz>

Hi unfortunately I don't have write access to kde-code-devel :(
I forward my email to you

best regards
C.

----------  Forwarded Message  ----------

Subject: Re: Reducing the number of conflicts in libraries
Date: Mon, 17 Sep 2001 15:55:17 -0400
From: Christophe Prud'homme <prudhomm@mit.edu>
To: kde-core-devel@mail.kde.org
Cc: kde-devel@mail.kde.org

Hum tell me if I am wrong but I think there is a mechanism in Gcc
to handle inline-function(if noinlining) and per-class vtable location
It can also be used in dealing with template instantiation  problems (see
 below) Consider the class MyClass

MyClass.hpp

#ifdef __GNUC__
#pragma interface
#endif

class MyClass
{};


MyClass.cpp

#ifdef __GNUC__
#pragma implementation
#endif

// implementation here ,,,


Not that it work also for templates using the -fexternal-template
go to
info:/gcc/Template

-- Copy of Info goc on G++ using
   info:/gcc/C++ Interface

`#pragma interface'
 `#pragma interface "SUBDIR/OBJECTS.h"'
      Use this directive in *header files* that define object classes,
      to save space in most of the object files that use those classes.
      Normally, local copies of certain information (backup copies of
      inline member functions, debugging information, and the internal
      tables that implement virtual functions) must be kept in each
      object file that includes class definitions.  You can use this
      pragma to avoid such duplication.  When a header file containing
      `#pragma interface' is included in a compilation, this auxiliary
      information will not be generated (unless the main input source
      file itself uses `#pragma implementation').  Instead, the object
      files will contain references to be resolved at link time.

      The second form of this directive is useful for the case where you
      have multiple headers with the same name in different directories.
      If you use this form, you must specify the same string to `#pragma
      implementation'.

 `#pragma implementation'
 `#pragma implementation "OBJECTS.h"'
      Use this pragma in a *main input file*, when you want full output
      from included header files to be generated (and made globally
      visible).  The included header file, in turn, should use `#pragma
      interface'.  Backup copies of inline member functions, debugging
      information, and the internal tables used to implement virtual
      functions are all generated in implementation files.

      If you use `#pragma implementation' with no argument, it applies to
      an include file with the same basename(1) as your source file.
      For example, in `allclass.cc', giving just `#pragma implementation'
      by itself is equivalent to `#pragma implementation "allclass.h"'.

      In versions of GNU C++ prior to 2.6.0 `allclass.h' was treated as
      an implementation file whenever you would include it from
      `allclass.cc' even if you never specified `#pragma
      implementation'.  This was deemed to be more trouble than it was
      worth, however, and disabled.

      If you use an explicit `#pragma implementation', it must appear in
      your source file *before* you include the affected header files.

      Use the string argument if you want a single implementation file to
      include code from multiple header files.  (You must also use
      `#include' to include the header file; `#pragma implementation'
      only specifies how to use the file--it doesn't actually include
      it.)

      There is no way to split up the contents of a single header file
      into multiple implementation files.

    `#pragma implementation' and `#pragma interface' also have an effect
 on function inlining.

    If you define a class in a header file marked with `#pragma
 interface', the effect on a function defined in that class is similar to
 an explicit `extern' declaration--the compiler emits no code at all to
 define an independent version of the function.  Its definition is used
 only for inlining with its callers.

    Conversely, when you include the same header file in a main source
 file that declares it as `#pragma implementation', the compiler emits
 code for the function itself; this defines a version of the function
 that can be found via pointers (or by callers compiled without
 inlining).  If all calls to the function can be inlined, you can avoid
 emitting the function by compiling with `-fno-implement-inlines'.  If
 any calls were not inlined, you will get linker errors.



bye

--

| Christophe Prud'homme, http://augustine.mit.edu/~prudhomm
| ICQ UIN: 24560867 Alias: Jesunix
|
| In theory, theory and practice are the same. In practice they are
| different.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic