jrl-umi3218 / RBDyn

RBDyn provides a set of classes and functions to model the dynamics of rigid body systems.
BSD 2-Clause "Simplified" License
157 stars 47 forks source link

Do not export symbols when building static libs #101

Closed costashatz closed 1 year ago

costashatz commented 1 year ago

Do not export symbols when building static library.. I guess this should be the correct way of doing this, no?

gergondet commented 1 year ago

@costashatz

What's the problem with the static build? Is it a problem to use __declspec(dllexport) when building a static library on Windows?

PS: I think the fix needs to be different since the RBDYN_STATIC flag needs to be adopted downstream to consume the API correctly in that case, it also needs to be applied to the parsers library

costashatz commented 1 year ago

What's the problem with the static build? Is it a problem to use __declspec(dllexport) when building a static library on Windows?

I have little experience with Windows, but in my project using __declspec(dllexport) to build the static lib and then __declspec(dllimport) to use it generates many C4251 warnings (which I treat as errors).

the RBDYN_STATIC flag needs to be adopted downstream to consume the API correctly in that case

What do you mean by that?

it also needs to be applied to the parsers library

True! I am not using the parsers and forgot to add it. I will.

gergondet commented 1 year ago

Thanks for the clarification @costashatz

I have made some small changes to the patch (fixed the CMake formatting and the typo for RBDynParsers) and pushed that to the master branch.