DIP45

From D Wiki
Revision as of 08:08, 27 August 2013 by Ingrater (talk | contribs) (Created page with "{| class="wikitable" !Title: !'''exoport(identifier)''' |- |DIP: |45 |- |Version: |1 |- |Status: |Draft |- |Created: |2013-08-27 |- |Last Modified: |2013-08-27 |- |Author: |Be...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Title: exoport(identifier)
DIP: 45
Version: 1
Status: Draft
Created: 2013-08-27
Last Modified: 2013-08-27
Author: Benjamin Thaut
Links: http://forum.dlang.org/post/5112D61B.5010905@digitalmars.com

http://d.puremagic.com/issues/show_bug.cgi?id=9816

Abstract

Add a identifier to the export protection level to make it useable for dll import/export on windows platforms. The Rationale section explains the problem and shows how this DIP solves it.

Description

Work in progress.


Rationale

The 'export' protection level was originally designed to work as the equivalent of C++ __declspec(dllimport) and __declspec(dllexport) at the same time. This however does not work, as the compiler cannot know without giving it additional context which 'export' are dllimport, which are dllexport and which are to be ignored.

Consider the following example: Two libraries A and B exists. Both of them are used by an executable. The library B uses library A.

- While compiling library A as shared library all 'export' protected symbols inside the source of A need to be treated as dllexport. - While compiling library B as shared library all 'export' protected symbols inside the source of A need to be treated as dllimport. All 'export' protected symbols inside the source of B need to be treated as dllexport. - When compiling the executable all 'export' protected symbols inside the source of A and B need to be treated as dllimport. - When compiling library A or B as static library 'export' should not have any effect at all.


Usign the identifier and command lines switches proposed in this DIP makes it possible to cover all of the above cases.


Copyright

This document has been placed in the Public Domain.