-
Notifications
You must be signed in to change notification settings - Fork 17
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
export symbols to enable msvc build #45
Comments
One method for exporting symbols on the Meson MSVC build is to compile a static library, export all symbols from that static library, then compile the dll using the .def file and the object files from the static library (or recompile the object files, I forgot which one). This method apparently works enough that some use it at their workplace and has the added benefit of not requiring __declspec(dllexport). |
Exporting of symbols is done through dumpbin /exports or dumpbin /linkermember. |
I put __declspec(dllexport) on c++ classes with source files and it seems that Meson is able to produce .lib files on its own. However, I get a link error like such:
|
From memory there are two parts to this problem:
Of course the alternative is just to build a fully static library... there's not much downside to this as the core functionality is pretty small, and in fact it should give a small performance improvement. |
Static compilation has the following error
This error also occurs for the tif image loader.
Additionally, the link error on the dll when compiling dynamically seems to be caused by openpiv-c--qt/openpiv/core/rect.h Line 77 in 8bdf76e
The issue could be caused by the overload not being exported since it is not part of a class member. |
Exporting operator << overloads fixes the problem! Compiles sucessfully with MS Visual Studio 2019 and 2022. |
I encountered an unexpected side effect of using Meson's dl export functionality. Although all executables compile and link properly, the executables are exporting symbols as such:
This could be eliminated using .def files with all symbols to create the dynamic library instead of dll exports, however the import lib would be much more messier due to lots of symbols being exported through libopenpivcore (very similar to CMake's WINDOWS_EXPORT_ALL_SYMBOLS). Here is the executable symbol table using CMake's WINDOWS_EXPORT_ALL_SYMBOLS
|
Issue is now fixed with preprocessor directives. |
Here is an interesting performance test. I wonder why GCC is so much faster (especially because I did not set any simd or mtune flags)? Performance of MSVC (Visual Studio 2022) compared to GCC 10 in release build (average of 10 runs)
|
It seems that I broke the Linux build again (-_-) See here for the segmentation violation fault. Other than that, Windows using Visual Studio (I'll have to update the CI to use Visual Studio instead of GCC) and Mac OS build tests pass. |
Linking pull request for this feature (#46) |
No description provided.
The text was updated successfully, but these errors were encountered: