GCC & precompiled headers question

Christoph Höger choeger at cs.tu-berlin.de
Thu May 6 11:04:23 UTC 2010


Hi all,

this is an off topic question, but since I know that some of you are
familiar with gcc, I am asking it here before signing up somewhere else.

I have to source-compile one language (Modelica) to C++. Since Modelica
has a structural subtype system, I'd like to create classes that way:

//Modelica
class Foo
	Real x;
end Foo;

//C++
template <Foo_Real> class Foo {
	Foo_Real x;
}

That means every generated class (and function for that matter) is
(parametric) polymorphic and can be reused in other compilation units
for subtypes. Unfortunately that also means, that I can only generate
headers and no libraries or object files. Basically g++ plays the role
of a linker for modelica. But this means that g++ will parse, check and
compile every header again and again even if it's clear (at least after
the first pass) that the code is sane.

I've learned that the C++ standard delivers the export keyword to
include template symbols in object files, but g++ does not support this.
The closest thing I've seen to export would be precompiled headers.
Unfortunately g++ also allows one single precompiled header per
compilation unit. Does anyone know why? And is there any way to speed up
the "linking" process a little (like letting g++ at least preprocess the
headers or something like this)? 

thanks for any comments,

Christoph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://lists.fedoraproject.org/pipermail/devel/attachments/20100506/bfbc36b6/attachment.bin 


More information about the devel mailing list