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

Fails to build shared library on WIndows/MSVC #5

Open
GyrosGeier opened this issue Jun 2, 2015 · 2 comments
Open

Fails to build shared library on WIndows/MSVC #5

GyrosGeier opened this issue Jun 2, 2015 · 2 comments

Comments

@GyrosGeier
Copy link

While building with MSVC (9.0) and -DBUILD_SHARED_LIBS:BOOL=TRUE, compilation fails because no import library is generated during the build.

To reproduce, open the "Command Shell" provided with the toolchain and run

cmake -DBUILD_SHARED_LIBS:BOOL=TRUE
nmake

Full log at http://ci.kicad-pcb.org/job/windows-sisl-msvc/cpu=x86,label=windows/10/console

@cbernardo
Copy link

This is due to the fact that __declspec(dllexport) and __declspec(dllimport) are only present in the forward declarations (sisl.h) and not present in the function definitions.

As an intermediate workaround there is a "sisl_exports.def" in my IGES library project (https://github.com/cbernardo/libIGES) and also a patch (0001-sisl.patch) discriminating MSVC and allowing an MSWin build via MSVC or MinGW. With the patch in place and the sisl_exports.def, I configure and build with:

cmake -G "VisualStudio 12 2013 Win64" -DBUILD_SHARED_LIBS:BOOL=TRUE -DCMAKE_SHARED_LINKER_FLAGS="/DEF:../sisl_exports.def" ..

cmake --build . -- /p:Configuration=Release

Of course it will be more convenient to have the export declaration in the source definition files themselves but that is a fairly big job since at least 172 functions needs to be altered for this. However, for future maintainability it is best to update the source definitions; for such a long list of exported functions, maintaining the export definition file would be error prone.

@GyrosGeier
Copy link
Author

That should be unnecessary -- exports work fine when just one declaration with the export attribute is in scope.

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

No branches or pull requests

2 participants