-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
Describe the feature or improvement you're requesting
It would be great if you could add proper support for the compilation of the library as DLL on Windows via the BUILD_SHARED_LIBS CMake variable. Currently the __declspec(dllexport) attribute is applied to many methods in the codebase. If there is no intention to support DLL compilation, please remove the __declspec(dllexport) attribute since it is not required for static libraries. I would even consider this an error as it is applied now. To support DLL compilation, something like this has to be implemented:
liboai\include\core\response.h:
#if defined(__linux__) || defined(__APPLE__)
#define LIBOAI_EXPORT
#else
#ifdef LIBOAI_DLL
#ifdef LIBOAI_BUILD
#define LIBOAI_EXPORT __declspec(dllexport)
#else
#define LIBOAI_EXPORT __declspec(dllimport)
#endif
#else
#define LIBOAI_EXPORT
#endif
#endif
liboai\CMakeLists.txt:
if(BUILD_SHARED_LIBS)
target_compile_definitions(${PROJECT_NAME}
PRIVATE
LIBOAI_BUILD
PUBLIC
LIBOAI_DLL
)
endif()
Furthermore, the LIBOAI_EXPORT
macro has to be applied to all methods that are used by a client.
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels