[LLVMdev] Compiling whole programs to bitcode

Charles Davis cdavis at mymail.mines.edu
Fri Jun 3 21:47:49 PDT 2011


On 6/3/11 10:43 PM, Russell Wallace wrote:
> On Sat, Jun 4, 2011 at 5:39 AM, Nick Lewycky <nicholas at mxc.ca> wrote:
>> If a program uses a templated function from a C++ library, either the C++
>> library provides an implementation of the template instantiated to that
>> type, or else the whole implementation was available in the header and ends
>> up in the TU of the program, not the library ((or else you'd get a link
>> error when building normally)).
> 
> Ah, but that's not the case, not with modern C++ compilers - it is
> perfectly possible for a templated function to be declared in a
> header, defined in a .cc file, called on a user-defined type, and
> nonetheless instantiated on the fly.
Not this modern C++ compiler. We don't support the 'export' keyword. In
fact, C++0x doesn't even have 'export' anymore.
> Of course that indeed wouldn't
> work in the simple C linkage model, which is why modern C++ compilers
> use one or another sort of black magic behind the scenes to deal with
> it. Is it documented how Clang deals with it?
Only one compiler supports 'export', and that's EDG's compiler. And boy,
was it a pain for them to implement (so I've heard). Let's just leave it
at that.

Chip



More information about the llvm-dev mailing list