Closed kalj closed 3 years ago
Don't quite understand what the problem on Windows is. Unfortunately, I don't have a windows toolchain set up so I cannot troubleshoot it currently. Any help would be very much appreciated.
Don't quite understand what the problem on Windows is. Unfortunately, I don't have a windows toolchain set up so I cannot troubleshoot it currently. Any help would be very much appreciated.
The problem is that you are defining a static global object in public headers, and then you are not exposing it appropriately to be visible. On Linux/macOS, everything works because the default visibility for this symbols is visible (see Section 2.2.2 of https://software.intel.com/sites/default/files/m/a/1/e/dsohowto.pdf for more info). To expose symbols in Windows shared library, we use the CMake property WINDOWS_EXPORT_ALL_SYMBOLS
, that however does not work with global variables, see https://blog.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/ and https://github.com/robotology/how-to-export-cpp-library/issues/41 . However, looking a bit more in the PR I am afraid there some preliminary problems, I will comment inline.
Don't quite understand what the problem on Windows is. Unfortunately, I don't have a windows toolchain set up so I cannot troubleshoot it currently. Any help would be very much appreciated.
The problem is that you are defining a static global object in public headers, and then you are not exposing it appropriately to be visible. On Linux/macOS, everything works because the default visibility for this symbols is visible (see Section 2.2.2 of https://software.intel.com/sites/default/files/m/a/1/e/dsohowto.pdf for more info). To expose symbols in Windows shared library, we use the CMake property
WINDOWS_EXPORT_ALL_SYMBOLS
, that however does not work with global variables, see https://blog.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/ and robotology/how-to-export-cpp-library#41 . However, looking a bit more in the PR I am afraid there some preliminary problems, I will comment inline.
To clarify, probably the easiest solution is just to have a regular function that returns a reference to the std::ostream &
, instead of using a global variable. Using a function instead of a global variable is also more convenient from the point of view of ABI maintenance.
Furthermore, can you please accept the CLA in https://cla-assistant.io/robotology/idyntree?pullRequest=700 ? Sorry for the request, but it is for internal policies.
Furthermore, can you please accept the CLA in https://cla-assistant.io/robotology/idyntree?pullRequest=700 ? Sorry for the request, but it is for internal policies.
Done!
@traversaro & @S-Dafarra Thanks for your suggestions and comments. I will prepare a fix.
The pushed commit contains fixes to the issues highlighted. I agree that a function std::ostream& debugStream()
is a better solution in all regards..
Just noted that I had tabs instead of spaces, and fixed it.
Are we missing something here?
Are we missing something here?
Note that depending on the notifications settings, it is possible that reviewers do not get notified if you push commits to a PR, so if you did not received feedback it may be due to that.
@kalj thank you for the contribution
Possible fix of #74.