summaryrefslogtreecommitdiff
path: root/xmake/templates/c++/shared/src/foo.h
diff options
context:
space:
mode:
authorruki <[email protected]>2026-02-28 21:55:13 +0800
committerruki <[email protected]>2026-02-28 21:55:13 +0800
commit5280c9480cb0d7d3ab55d516e296152ec273e14a (patch)
treeaf041546121010fdad5639c231ad2b2a4900aa12 /xmake/templates/c++/shared/src/foo.h
parent71e10b70334401d46c47f574c8f46fcd20ccf818 (diff)
rewrite templates
Diffstat (limited to 'xmake/templates/c++/shared/src/foo.h')
-rw-r--r--xmake/templates/c++/shared/src/foo.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/xmake/templates/c++/shared/src/foo.h b/xmake/templates/c++/shared/src/foo.h
new file mode 100644
index 000000000..bd496c784
--- /dev/null
+++ b/xmake/templates/c++/shared/src/foo.h
@@ -0,0 +1,17 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(_WIN32)
+#define __export __declspec(dllexport)
+#elif defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
+#define __export __attribute__((visibility("default")))
+#else
+#define __export
+#endif
+
+__export int add(int a, int b);
+
+#ifdef __cplusplus
+}
+#endif