-
Notifications
You must be signed in to change notification settings - Fork 46
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
common: Fix symbol export using MSVC #49
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.
Just a small nit (for reasons of consistency under Windows), otherwise LGTM.
There's a further nit I had not noticed @asoulier, as regards importing shared v. static libraries.
Those could be tackled at once with a combination of defines for the shared build ( |
src/common.h
Outdated
@@ -86,8 +86,11 @@ | |||
* Change the visibility of interface functions | |||
*/ | |||
|
|||
#define LC3_EXPORT \ | |||
__attribute__((visibility ("default"))) | |||
#ifdef _WIN32 |
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.
The bit in #49 (comment) as regards static libraries on Windows still needs addressing.
e1e578a
to
38e0b88
Compare
@amyspark I have added a CI to check compilation with MSVC. Thanks. |
@asoulier I think the only bit missing is the ability to build liblc3 statically too. Currently we'd need to hardcode the |
I changed the
This works for me on linux. |
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 tested again and MSVC 17.10 Preview 2, GCC 13.2 Rev 5 (MSYS2 UCRT64) and Clang 17 (CLANG64) are all happy.
*/ | ||
|
||
#ifdef _WIN32 | ||
#define LC3_EXPORT __declspec(dllexport) |
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 wonder if LC3_EXPORT could be moved to the src functions rather than a header which is public?
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.
MSVC needs a match between functions declaration and definitions.
So the header declarations needs to be decorated with __declspec(dllexport)
.
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 see, thanks
@amyspark Thanks for your checks! |
No description provided.