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