Open-Agriculture / AgIsoStack-plus-plus

AgIsoStack++ is the completely free open-source C++ ISOBUS library for everyone
https://agisostack.com/
MIT License
193 stars 43 forks source link

Compiling the Isobus lib as a static lib causes some protocols to be optimized out #61

Closed ad3154 closed 1 year ago

ad3154 commented 1 year ago

This is an unintended side effect of #58. Because TransportProtocolManager and ExtendedTransportProtocolManager are not directly called anywhere (only indirectly through the list of all protocols) the linker optimizes out those classes and their static singletons do not ever get instantiated.

ad3154 commented 1 year ago

It looks like one viable solution to this is to add -Wl,--whole-archive to the target_link_libraries step for only the isobus::Isobus library. I will perform some testing with this and if it is viable as a solution I will add it to all tutorials, readme, and examples. Compiling and linking will still work without it, but it will omit the transport layer completely without it, limiting your app to 8 byte messages.