-
-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Windows: Make -fvisibility=public export all defined symbols
To pave the way for simple DLL generation (end goal: druntime-ldc-shared.dll). The dllexport storage class for functions definitions is enough; the automatically generated import .lib seems to resolve the regular symbol name to the actual symbol (__imp_*), so dllimport for declarations seems superfluous. For global variables, things are apparently different unfortunately.
- Loading branch information
Showing
9 changed files
with
61 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Tests that -fvisibility=public for Windows targets exports defined symbols | ||
// (dllexport) without explicit `export` visibility, and that linking an app | ||
// against such a DLL via import library works as expected. | ||
|
||
// REQUIRES: Windows | ||
|
||
// generate DLL and import lib | ||
// RUN: %ldc %S/inputs/fvisibility_dll_lib.d -betterC -shared -fvisibility=public -of=%t_lib.dll | ||
|
||
// compile, link and run the app | ||
// RUN: %ldc %s -I%S/inputs -betterC %t_lib.lib -of=%t.exe | ||
// RUN: %t.exe | ||
|
||
import fvisibility_dll_lib; | ||
|
||
extern(C) void main() | ||
{ | ||
//assert(dllGlobal == 123); | ||
const x = dllSum(1, 2); | ||
assert(x == 3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
__gshared int dllGlobal = 123; | ||
|
||
double dllSum(double a, double b) | ||
{ | ||
return a + b; | ||
} |