diff options
| author | ruki <[email protected]> | 2022-10-08 00:40:27 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-10-08 00:40:27 +0800 |
| commit | 2c4ce2f510178a00c43cd16d7c85819b4a289423 (patch) | |
| tree | 02f4c723916292062a0a8a99317de517ad15d666 | |
| parent | eb9a3a5c4a74452d78b221e0af738f040fbcd198 (diff) | |
improve template
| -rw-r--r-- | xmake/templates/dlang/shared/project/src/interfaces.d | 14 | ||||
| -rw-r--r-- | xmake/templates/dlang/shared/project/xmake.lua | 3 |
2 files changed, 13 insertions, 4 deletions
diff --git a/xmake/templates/dlang/shared/project/src/interfaces.d b/xmake/templates/dlang/shared/project/src/interfaces.d index 3386c9124..b4f7ab6ba 100644 --- a/xmake/templates/dlang/shared/project/src/interfaces.d +++ b/xmake/templates/dlang/shared/project/src/interfaces.d @@ -1,9 +1,15 @@ -extern(C) int add(int a, int b) -{ +version(Windows) { + import core.sys.windows.windows; + import core.sys.windows.dll; + mixin SimpleDllMain; +} + +extern(C) int add(int a, int b) { return a + b; } -extern(C) int sub(int a, int b) -{ +extern(C) int sub(int a, int b) { return a - b; } + + diff --git a/xmake/templates/dlang/shared/project/xmake.lua b/xmake/templates/dlang/shared/project/xmake.lua index 277b2e611..b9cc7cb8f 100644 --- a/xmake/templates/dlang/shared/project/xmake.lua +++ b/xmake/templates/dlang/shared/project/xmake.lua @@ -4,6 +4,9 @@ target("${TARGETNAME}") set_kind("shared") add_files("src/interfaces.d") add_includedirs("src", {public = true}) + add_rules("utils.symbols.export_list", {symbols = { + "add", + "sub"}}) target("${TARGETNAME}_demo") set_kind("binary") |
