I’m seeing that when I compile an executable with a large library, and I check the function definitions via nm I see that the functions in the binary is defined i.e
However when I do the same thing but make it a library (i.e. use add_library instead of add_executable) I see the following when I run nm
nm program.a
......... U funcnameFromLibrary
Am I missing something else when I’m linking the function for library compilation? my CMakeList.txt is the exact same except for the fact that I use add_library instead of add_executable
Static libraries do not copy symbols from anywhere other than the objects passed in. I suspect that funcnameFromLibrary comes from a static library. Building a shared library or executable against a static library will copy any object files which provide symbols into the resulting binary. This causes it to be defined in those but “undefined” in a static library.
Ye, I added SHARED in my add_library build, and that seemed to fix the exporting of the functions with what I need, running into a whole new weird issue now.