From 2c4ce2f510178a00c43cd16d7c85819b4a289423 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 8 Oct 2022 00:40:27 +0800 Subject: improve template --- xmake/templates/dlang/shared/project/src/interfaces.d | 14 ++++++++++---- 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") -- cgit v1.3.1