summaryrefslogtreecommitdiff
path: root/tests/projects
diff options
context:
space:
mode:
authorruki <[email protected]>2026-02-07 11:02:38 +0800
committerGitHub <[email protected]>2026-02-07 11:02:38 +0800
commit15d8fed683b17f3bff4abb3d36f79fa291ac577c (patch)
tree044a4a9b8b824cdb7aba3a513b28ae701e69cd16 /tests/projects
parent4780a467c144f27a4c2f9923d030750d0f25f5a5 (diff)
parent08f5b8a7bdac97cab8f5055a5ae9b066d2b18664 (diff)
Merge pull request #7302 from xmake-io/missdll
Improve run process errors
Diffstat (limited to 'tests/projects')
-rw-r--r--tests/projects/windows/windows_links/src/foo.c9
-rw-r--r--tests/projects/windows/windows_links/src/main.c21
-rw-r--r--tests/projects/windows/windows_links/xmake.lua20
3 files changed, 50 insertions, 0 deletions
diff --git a/tests/projects/windows/windows_links/src/foo.c b/tests/projects/windows/windows_links/src/foo.c
new file mode 100644
index 000000000..29b5a4334
--- /dev/null
+++ b/tests/projects/windows/windows_links/src/foo.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+void foo() {
+ printf("foo called\n");
+}
+
diff --git a/tests/projects/windows/windows_links/src/main.c b/tests/projects/windows/windows_links/src/main.c
new file mode 100644
index 000000000..bc94c3f13
--- /dev/null
+++ b/tests/projects/windows/windows_links/src/main.c
@@ -0,0 +1,21 @@
+#include <windows.h>
+#include <psapi.h>
+#include <stdio.h>
+
+__declspec(dllimport) void foo();
+
+int main() {
+ PROCESS_MEMORY_COUNTERS pmc;
+ printf("Calling GetProcessMemoryInfo...\n");
+ if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
+ printf("PageFaultCount: %lu\n", pmc.PageFaultCount);
+ printf("WorkingSetSize: %lu\n", pmc.WorkingSetSize);
+ } else {
+ printf("GetProcessMemoryInfo failed (%lu)\n", GetLastError());
+ }
+ printf("Calling foo...\n");
+ foo();
+ printf("Done.\n");
+ return 0;
+}
+
diff --git a/tests/projects/windows/windows_links/xmake.lua b/tests/projects/windows/windows_links/xmake.lua
new file mode 100644
index 000000000..57ae03712
--- /dev/null
+++ b/tests/projects/windows/windows_links/xmake.lua
@@ -0,0 +1,20 @@
+add_rules("mode.debug", "mode.release")
+
+set_policy("run.windows_error_dialog", true)
+
+target("foo")
+ set_kind("shared")
+ add_files("src/foo.c")
+
+target("test_foo_dll_presence")
+ set_kind("binary")
+ add_files("src/main.c")
+ add_deps("foo")
+ add_syslinks("psapi")
+ after_build(function (target)
+ local foo = target:dep("foo")
+ if foo then
+ os.tryrm(foo:targetfile())
+ end
+ end)
+