-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix build and add functions to dll #50
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hint: There is a std::string::data() function added so you can write something like:
std::string s(size);
MdfTagGetName(eTag, s.data());
instead
It doesn't work. std::string is not std::vector. The following code works sometimes, but sometimes it doesn't, std::string str;
str.reserve(MdfAttachmentGetFileType(attachment, nullptr) + 1);
str.resize(MdfAttachmentGetFileType(attachment, str.data()));
return str; |
std::string s(size, '\0'); ? |
message(STATUS "CLR compile") | ||
add_library(mdflibrary SHARED | ||
src/MdfExport.cpp src/MdfExport.h | ||
# C++ files | ||
src/MdfExport.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the CMake manual, you should add library as a MODULE. If so, you dont't need the Export.cpp file. The -NET have all export function. Well worth a try at least
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot. src/MdfExport.cpp
contains functions that need to be exported. If change SHARED to MODULE, cmake would not export symbols to dll.
As the CMake manual said.
"For example, a Windows resource DLL or a managed C++/CLI DLL that exports no unmanaged symbols would need to be a MODULE library."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to change SHARED to MODULE, and cmake complains that Target "mdflibrary" of type MODULE_LIBRARY may not be linked into another target. One may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to executables with the ENABLE_EXPORTS property set.
when run target_link_libraries(mdflibraryexample PRIVATE mdflibrary)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor check if the SHARED ->MODULE is a simpler solution
No description provided.