-
Notifications
You must be signed in to change notification settings - Fork 21
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
How to really use rosconsole_bridge? #12
Comments
Absolutely! Maybe you can add a note to the wiki page. Please link the diff here so future readers can find it if you do so.
While that would be convenient it would also break existing code which does use the macro, e.g.:
So it needs to be ensured that multiple uses of the macro don't break the behavior if the macro is going to be used automatically within |
Thanks for the feedback! With the PR #13 it becomes trivial to truly support activation by linking without breaking existing code (thanks to the PR not changing ABI and (specified) API): the However, there is an issue with this original dream that I didn't think of before: linking to a library without using any of its symbols is not reliable if linking is performed on an "as needed" basis (GNU linker: The missing piece would be to deactivate "as needed" for this library specifically. But that seems to be difficult with If that turns out to be too difficult or too expensive I see two options how to proceed:
|
Since I stumbled across the same problem I now updated the package documentation. http://wiki.ros.org/action/info/rosconsole_bridge?action=diff&rev2=4&rev1=3 |
The requirement to use
REGISTER_ROSCONSOLE_BRIDGE
(e.g. https://github.com/ros/rosconsole_bridge/blob/indigo-devel/test/cleanup.cpp#L16) is not mentioned in http://wiki.ros.org/rosconsole_bridge, which states instead :However it doesn't work without
REGISTER_ROSCONSOLE_BRIDGE;
somewhere to actually cause the redirection.Assuming that this is intended, a) it should be mentioned in the documentation, and b) there seems to be a design flaw not providing a clean solution for the following situation (among others):
Lib
A
depends on ROS and libB
, which uses console_bridge. Then libA
should ideally already activaterosconsole_bridge
for libB
to nicely work as ROS-lib and therefore have somewhereREGISTER_ROSCONSOLE_BRIDGE;
. However, in an executable that depends on A and an A' doing the same thing would end up redirecting the console twice through A and A'. This works but yields unclean shutdown because it is apparently not supported in https://github.com/ros/console_bridge/blob/master/src/console.cpp#L94 since there is only oneprevious_output_handler_
.All problems could (IMO) be solved simply by using
REGISTER_ROSCONSOLE_BRIDGE
within therosconsole_bridge
library itself and not in its clients. This should make sure that the redirection is only happening once per executable AND get rid of this requirement for client packages and make the simplicity promised in the wiki come true.What is wrong with this approach?
The text was updated successfully, but these errors were encountered: