It is not clear where and how to configure a build for exposing RTAPI symbols in `liblinuxcnchal.so`
Issue by luminize
Fri Mar 16 16:44:59 2018
Originally opened as https://github.com/machinekit/machinekit/issues/1360
I could not find how to enable the RTAPI flags to build on a RT-PREEMPT kernel No urgent matter, but annoying :) see also #1359
This issue starts to bite when building outside the tree, using instcomp, or using HAL internals in a C++ userspace program for instance.
hal_lib.c exports a large number of symbols, but only if RTAPI is defined in CFLAGS. So functions present in hal headers, error as undefined when you try to load the component, even though it builds.
This leaves components linked against liblinuxcnchal.so built for posix say, unable to access something as basic as hal_data, to be able to get the mutex and interrogate pin values or similar.
The only real valid reason not to export symbols in a dynamic library, is to hide the internal API and leave the approved accessor (getter / setter) functions visible.
Since leaving hard kernel threads behind, are there actually good reasons behind a lot of the
#ifdef RTAPI conditionals in the code?
To be re-visited I expect, but I wasted half a day as a result of this today, before I realised what was happening and exporting the hal_lib functions gave me a perfectly working instantiated component able to resolve all the calls made to HAL functions.