diff options
| author | ruki <[email protected]> | 2017-05-19 21:30:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-05-19 21:32:13 +0800 |
| commit | 03b7d8b955d11895cc15332360eca7b14d6cf58f (patch) | |
| tree | 4aa9b47aa3f1957a0a4343e7b1c4a8357e7018d5 /tests/projects/shared_library_c++/src | |
| parent | 58e3bad5859530c8316de4b4b7939169cdd2c492 (diff) | |
add projects and modules in tests
Diffstat (limited to 'tests/projects/shared_library_c++/src')
| -rwxr-xr-x | tests/projects/shared_library_c++/src/interface.cpp | 6 | ||||
| -rwxr-xr-x | tests/projects/shared_library_c++/src/interface.h | 24 | ||||
| -rwxr-xr-x | tests/projects/shared_library_c++/src/test.cpp | 10 |
3 files changed, 40 insertions, 0 deletions
diff --git a/tests/projects/shared_library_c++/src/interface.cpp b/tests/projects/shared_library_c++/src/interface.cpp new file mode 100755 index 000000000..598d07560 --- /dev/null +++ b/tests/projects/shared_library_c++/src/interface.cpp @@ -0,0 +1,6 @@ +#include "interface.h" + +int add(int a, int b) +{ + return a + b; +} diff --git a/tests/projects/shared_library_c++/src/interface.h b/tests/projects/shared_library_c++/src/interface.h new file mode 100755 index 000000000..ef24ba3ce --- /dev/null +++ b/tests/projects/shared_library_c++/src/interface.h @@ -0,0 +1,24 @@ +#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 + +/*! calculate add(a, b) + * + * @param a the first argument + * @param b the second argument + * + * @return the result + */ +__export int add(int a, int b); + +#ifdef __cplusplus +} +#endif diff --git a/tests/projects/shared_library_c++/src/test.cpp b/tests/projects/shared_library_c++/src/test.cpp new file mode 100755 index 000000000..72e03272b --- /dev/null +++ b/tests/projects/shared_library_c++/src/test.cpp @@ -0,0 +1,10 @@ +#include "interface.h" +#include <iostream> + +using namespace std; + +int main(int argc, char** argv) +{ + cout << "add(1, 2) = " << add(1, 2) << endl; + return 0; +} |
