Skip to content
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

Merged
merged 3 commits into from
Oct 7, 2019
Merged

Fix symbols visibility on Windows #90

merged 3 commits into from
Oct 7, 2019

Conversation

vtorri
Copy link
Contributor

@vtorri vtorri commented Jun 26, 2019

both static and shared linking have been tested (with the frontend)

@vtorri
Copy link
Contributor Author

vtorri commented Jun 26, 2019

I can give you more details if you want

@vtorri
Copy link
Contributor Author

vtorri commented Jul 3, 2019

you are not convinced by this PR ?

@vtorri
Copy link
Contributor Author

vtorri commented Oct 3, 2019

will you have time to review this PR ?

@njh
Copy link
Owner

njh commented Oct 3, 2019

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?

https://docs.travis-ci.com/user/reference/windows/

@@ -3,6 +3,7 @@ AM_CFLAGS = -I ../build/ $(WARNING_CFLAGS)
lib_LTLIBRARIES = libtwolame.la
include_HEADERS = twolame.h

libtwolame_la_CPPFLAGS = -DTWOLAME_BUILD
Copy link
Owner

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?

Copy link
Contributor Author

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.

Copy link
Owner

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?

Copy link
Contributor Author

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. "

Copy link
Owner

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.

Copy link
Contributor Author

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"

@vtorri
Copy link
Contributor Author

vtorri commented Oct 3, 2019

to have a CI for windows, maybe appveyor is better than travis
you can also install mingw-w64 cross toolchain and compile it like a unix build

@njh njh changed the title fix symbols visibility on Windows Fix symbols visibility on Windows Oct 7, 2019
@njh njh merged commit e52373e into njh:master Oct 7, 2019
@njh
Copy link
Owner

njh commented Oct 7, 2019

Sorry for the delay in getting this merged.

I have made one minor change: 7cf0a8a

I renamed TWOLAME_BUILD define to LIBTWOLAME_BUILD.
This is to clarify that LIBTWOLAME_BUILD should only be set when building libtwolame and not the twolame frontend binary.

@vtorri
Copy link
Contributor Author

vtorri commented Oct 7, 2019

no problem for me :-) thanks

@vtorri
Copy link
Contributor Author

vtorri commented Oct 7, 2019

i'll check this evening the compilation on Windows.

for appveyor : https://www.appveyor.com/docs/windows-images-software/

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

Successfully merging this pull request may close these issues.

2 participants