diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-06-14 18:05:12 -0400 |
|---|---|---|
| committer | Tim Foley <tfoleyNV@users.noreply.github.com> | 2019-06-14 15:05:12 -0700 |
| commit | 1fe24d3a74a9cd51c4a025cd0e78642f3e29df79 (patch) | |
| tree | a52d2b1e05f0d22accbb70eb4bea69d7c67455a4 /tests/cpp-compiler/c-compile-shared-library.c | |
| parent | 8c56d83506ef92b15b15bdb5969008dd69c8d2a6 (diff) | |
Runtime Shared Library compilation and testing (#985)
* Removed the need for VisualStudio specific CPPCompiler
Improved the version parsing for gcc/clang
Removed need for slang-unix-cpp-compiler-util.cpp/.h
Remove binary before compiling in the compile c tests
* Moved VisualStudio calcArgs into CPPCompilerUtil - as code is not windows specific.
* Set up compile time version for gcc and clang
* Fix compilation on OSX - use remove instead of unlink for file deletion.
* On OSX - clang uses different string format.
* Removed /bin/sh invoking as not required for OSX.
* First pass working testing with shared libraries.
Diffstat (limited to 'tests/cpp-compiler/c-compile-shared-library.c')
| -rw-r--r-- | tests/cpp-compiler/c-compile-shared-library.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/cpp-compiler/c-compile-shared-library.c b/tests/cpp-compiler/c-compile-shared-library.c new file mode 100644 index 000000000..8b6be6115 --- /dev/null +++ b/tests/cpp-compiler/c-compile-shared-library.c @@ -0,0 +1,25 @@ +//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_C DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue) +{ + strcpy(outTextValue, textValue); + return intValue; +} + |
