summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cpp-compiler/c-compile-pass-through-shared-library.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/cpp-compiler/c-compile-pass-through-shared-library.c b/tests/cpp-compiler/c-compile-pass-through-shared-library.c
new file mode 100644
index 000000000..9f33bc430
--- /dev/null
+++ b/tests/cpp-compiler/c-compile-pass-through-shared-library.c
@@ -0,0 +1,24 @@
+//TEST(smoke,shared-library):CPP_COMPILER_COMPILE: -pass-through c -entry test -target callable
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#if defined(_MSC_VER)
+# define DLL_EXPORT __declspec(dllexport)
+#else
+# define DLL_EXPORT __attribute__((__visibility__("default")))
+#endif
+
+#ifdef __cplusplus
+#define EXTERN_C extern "C"
+#else
+#define EXTERN_C
+#endif
+
+EXTERN_C DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue)
+{
+ strcpy(outTextValue, textValue);
+ return intValue;
+}
+