DIP45: fixing the dllimport/dllexport issue

Martin Nowak code at dawg.eu
Mon Nov 4 15:27:33 PST 2013


On 09/08/2013 09:33 AM, Benjamin Thaut wrote:
> There is yet another problem to be solved. What should happen with
> tempaltes? Does it make sense to export templates?

Yes, we need to export/import symbols from templates. Recently the 
compiler was changed to skip instantiations when they have already been 
instantiated in imported modules.
There is a problem similar to the lib case though. When you instantiate 
an exported template you don't want it's symbols exported from your 
shared library.

> What happens if a template class marked with export gets instanciated in different DLLs
> using the same template arguments? Should the TypeInfo objects match?
> Should templates be exportable in generall?

Yes TypeInfos should match. For symbols which are allowed to have 
multiple definitions (like typeinfos from template classes) we can't 
solely rely on pointer comparison but also need to test typename equality.



More information about the Digitalmars-d mailing list