Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Can the lib be used as Run-time library ? #645

lauhwayu started this conversation in General
Discussion options

I compiled the library by VS2019 and it is really a wonderful tools for my project.
I can only use it as a static library. Is it possible to be run as a run-time library?

You must be logged in to vote

Replies: 1 comment 3 replies

Comment options

Try setting -DBUILD_SHARED_LIBS=ON when configuring the CMake build.

You must be logged in to vote
3 replies
Comment options

I tried DBUILD_SHARED_LIBS option, while many test cases can't failed. I thought that some variables and procedures need be assigned with DLLEXPORT attributes

Comment options

Maybe worth to also force export of all symbols to avoid declaring them individually with DLLEXPORT:

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 78270a5..dce8e30 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -94,6 +94,13 @@ set(SRC
 
 add_library(${PROJECT_NAME} ${SRC})
 
+set_target_properties(
+ ${PROJECT_NAME}
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON
+ WINDOWS_EXPORT_ALL_SYMBOLS ON
+)
+
 if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10.0)
 target_compile_options(
 ${PROJECT_NAME}
Comment options

Think you! It works now!
Happy Weekend!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /