-
Notifications
You must be signed in to change notification settings - Fork 35
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 symbols visibility on Windows #90
Conversation
I can give you more details if you want |
you are not convinced by this PR ? |
will you have time to review this PR ? |
The problem is that I have no way of testing this, or knowing if the Windows build is working correctly. I also have no idea about best practices for Windows. Would it be possible to add a Windows build to Travis CI? |
@@ -3,6 +3,7 @@ AM_CFLAGS = -I ../build/ $(WARNING_CFLAGS) | |||
lib_LTLIBRARIES = libtwolame.la | |||
include_HEADERS = twolame.h | |||
|
|||
libtwolame_la_CPPFLAGS = -DTWOLAME_BUILD |
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.
Having to add this seems weird to me.
Probably not actually a problem but it also gets set for all OSes, not just Windows.
Is there a different way of doing this?
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.
if you look carefully, TWOLAME_BUILD is used only in a #ifdef _WIN32 , so anyway, TWOLAME_BUILD will be pased to the preprocessor only if a Windows compiler is used.
I can add a test in Makefile.am, but the test is already done with the #ifdef _WIN32, so it would be useless.
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.
Yup, I can see that it is only used into the #ifdef _WIN32
.
But is there no built-in way in automake of detecting what is being built, rather than having to define TWOLAME_BUILD ourselves?
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.
https://www.gnu.org/software/libtool/manual/libtool.html#Windows-DLLs :
"When the objects that form the library are built, there are generally two copies built for each object. One copy is used when linking the DLL and one copy is used for the static library. On Windows systems, a pair of defines are commonly used to discriminate how the interface symbols should be decorated. The first define is ‘-DDLL_EXPORT’, which is automatically provided by Libtool when libtool builds the copy of the object that is destined for the DLL. The second define is ‘-DLIBFOO_BUILD’ (or similar), which is often added by the package providing the library and is used when building the library, but not when consuming the 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.
Ah, thanks! It is really useful to know that is the official libtool way of doing it. I will try and get this merged tomorrow.
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.
another good reading : https://gcc.gnu.org/wiki/Visibility section "How to use the new C++ visibility support"
to have a CI for windows, maybe appveyor is better than travis |
Sorry for the delay in getting this merged. I have made one minor change: 7cf0a8a I renamed |
no problem for me :-) thanks |
i'll check this evening the compilation on Windows. for appveyor : https://www.appveyor.com/docs/windows-images-software/ |
both static and shared linking have been tested (with the frontend)