Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-01-04 00:55:25


David Abrahams wrote:
> "Robert Ramey" <ramey_at_[hidden]> writes:
>
>> All combinations of A and T actually used - and only those
>> combinations - are used to instantiate code.
>
> I don't think that can be true for any reasonable definition of
> "used." Code in one TU can't tell what other TUs are doing, so the
> code is instantiated for all archives whose headers have been
> included. IIRC it gets around the ordering problems you were having
> before by doing the instantiation as the result of overload resolution
> on an unqualified call, which happens in phase 2 and thus doesn't
> depend on having seen the overload for a particular archive type
> before the serializable type is EXPORTed. It doesn't do any other
> deep magic, IIRC.

After I thought about this some more I've also come to agree with this.

So the above would be better said

All combinations of A and T actually used - and only those
combinations - are used to instantiate code - in a transation
unit with at least one function called from either directly or
indirectly from main.

I never really picked up on this. This is probably because all
but a couple of tests to be only one module long. I suspect
that were I to modify one of export tests - it would fail in
release mode in one or another of the compilers. But maybe
not. The inclusion of "force_include.hpp" and corresponding
usage of "_export" will probably guarentee that the compiled
code is never stripped. So the problem may never be manifested
in such a test.

question: does the CW compiler include something like "_export"
in order to compile windows (or *nix?) DLLS (shared libraries)?

question:what if anything does the standard say about something
like "_export" which is necessary in order to communicate that
the corresponding code should never be stripped?

I've been under the impression that

a) "_export" is not portable
b) "_export" or something like is necessary to supress code stripping
c) suppression of code stripping is necessary in order to make a DLL

which would imply that in order to produce a DLL, a compiler must
be non-conforming - or at least support non-corformant behavior.

Am I missng something here?

Robert Ramey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk