coin-or / qpOASES

Open-source C++ implementation of the recently proposed online active set strategy
GNU Lesser General Public License v2.1
397 stars 132 forks source link

Dynamic library for Windows #117

Closed jhallier closed 3 years ago

jhallier commented 3 years ago

Hi, currently, a dynamic library for Windows is not supported. As far as I see and have already tried locally, all it takes is to precede the headers of the classes with a __declspec(dllexport) declaration. This could also be activated with a preprocessor directive that can be activated from CMake or the configure scripts. If there is interest, I could prepare a PR with the changes, unless there is some other reason why this was not yet done?

traversaro commented 3 years ago

I am not a mantainer of qpOASES, but I would be interested in that. I tried in the past via CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS (see https://github.com/coin-or/qpOASES/pull/109#issue-574762899), but it was not working due to the presence of static variables. However, using visibility annotations as you propose should work fine.

apotschka commented 3 years ago

Thanks! I'd certainly like the feature.

The non-cmake build process currently also has WIN32 #defined in make_windows.mk. You should be fine with using something like

#ifdef WIN32
__declspec(dllexport)
#endif

This could be hidden inside another macro, e.g., named DLL_EXPORT.

I'd appreciate your PR.

jhallier commented 3 years ago

Ok, I've added a PR for discussion https://github.com/coin-or/qpOASES/pull/118 Closed this issue here then.