diff --git a/.gitignore b/.gitignore index d23b03b..71df0a0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ build *.asta.lock *.jude *.idea +cmake-build-release \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c27675..ac09fb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,3 +6,4 @@ add_subdirectory(AdversarialSearch/Minimax) add_subdirectory(Miscellaneous) add_subdirectory(NeuralNetwork/Perceptron) add_subdirectory(NeuralNetwork/MLP) +add_subdirectory(Export) diff --git a/Export/CMakeLists.txt b/Export/CMakeLists.txt new file mode 100644 index 0000000..09f76a5 --- /dev/null +++ b/Export/CMakeLists.txt @@ -0,0 +1,9 @@ +add_definitions(-D MATHLIBRARY_EXPORTS) +set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/DLL) + +set(FILES + MathLibrary.cpp + ) +add_executable(MathLibrary ${FILES}) + +add_library(MathLibrary_DLL SHARED MathLibrary.cpp) diff --git a/Export/MathLibrary.cpp b/Export/MathLibrary.cpp new file mode 100644 index 0000000..aac091f --- /dev/null +++ b/Export/MathLibrary.cpp @@ -0,0 +1,16 @@ +#include "MathLibrary.h" + +int sum(int lhs, int rhs) +{ + return lhs + rhs; +} + +int getOne() +{ + return 1; +} + +int main(int argc, char *argv[]) +{ + return 0; +} \ No newline at end of file diff --git a/Export/MathLibrary.h b/Export/MathLibrary.h new file mode 100644 index 0000000..a0d5bd9 --- /dev/null +++ b/Export/MathLibrary.h @@ -0,0 +1,12 @@ +// MathLibrary.h - Contains declarations of math functions +#pragma once + +#ifdef MATHLIBRARY_EXPORTS +#define MATHLIBRARY_API __declspec(dllexport) +#else +#define MATHLIBRARY_API __declspec(dllimport) +#endif + +extern "C" MATHLIBRARY_API int sum(int lhs, int rhs); + +extern "C" MATHLIBRARY_API int getOne();