[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

C++ linked with other languages



A topic that has come up in comp.lang.c++ is linking c++ stuff
with other languages.  The only thing that has come up that presents any
real problem is the matter of initializing static globals.

The initialization of static globals is accomplished in C++ by a post
ld pass that scans the name table of the linked file and generates 
a initialization routine that it links in.  The problem is that
users of another language, C for instance, won't have this final phase
lying around in a convenient way.  The solution is to either have the C++
not use the offending construct, or to have it link in its own version
of the initialization stuff.  This presents a minor problem in that it
requires the application to explicitly call an initialization routine,
but with all the other junk we have, this is a very minor thing.

I'm not sure how difficult it will be to do either of these alternatives,
both are possible, and were considered as fallback positions if some
platform proved recalcitrant, but this is a more direct and immidiate need.