Topic: Proposed Linking Standard


Author: leblanck@austin.ibm.com (Karalee LeBlanc)
Date: 1995/04/28
Raw View

  We've had a ton of problems on OS/2 because our C++ templates have
static data in them.  In the 2.0 compiler, that means you can either
hide your template instantiations (i.e. have the compiler instantiate
them, and not let their symbols appear in the import library) which causes
a lot of code bloat.  Or you can have a single, but visible, instantiation
of each template for all the shared libraries in your system.  To keep the size
of our libraries down, we've gone with the second approach.
  Unless only a few templates are instantiated, I think most folks would
go with the second approach.
  The concern is: If we give the customer templates with static data, and
different customers develop different applications using these templates,
we will probably have the problem where two different vendors create two
different products using our templates, and they both need the same template
instantiation.  That means the different products are duplicately defining
the same template, and no customer could link to both of the products without
getting duplicate defintions.
  Now I know OS/2 plans to solve this problem, and allow the duplicate
definitions (just like AIX does now).  So the AIX and OS/2 platforms are
covered.  But I know the Metaware compiler (on NT) has this problem,
and there are probably others.  It seems each compiler gets to decide
whether or not they allow duplicate definitions of static template data.
I kind of think this should be a language standard.  The compiler/linker
should be able to handle it.  Yes, give me warning messages, let me know
what's going on.  But don't force an error and prevent the link.



--
-----------------------------------------------------
Karalee LeBlanc
Dept 908, Bld 008, Room 7D050
Austin, Tx.  Tie/Phone 678/838-3409