I am working on the reorganization of a set of old utilities and the creation of a new server that will use common code for everyone to unify their functionality and allow external access by remote clients. For each utility, I take the code that I need for the server and reorganize it into a shared library so that the utility and server can now communicate with the shared library. Due to the way the former developer of these utilities did something, they pretty much just copied and pasted everything when they needed to create a new utility, so there are a ton of functions that have the same signature (i.e. Callbacks for XML parsing), but do different things inside.
When I run standalone utilities that have been reorganized to communicate with common code, they work just fine. When I try to use a server with the same functionality as the specified utility, the server uses the code from the first library to which it is linked, and not from the library from which it should work.
For example, I have xml for devices A, B, C, which are parsed by the common xml library, but each device has its own library libA, libB, libC used by the server. When I make a call to the server to send xml to device C, it uses the "HandleStartElement" function from libA and not the same name and signature function in libC, although shared libraries only declare these functions internally and do not use, t to share headers that mention these internal xml parsers.
Can someone explain to me why he is not reading the correct function and how to avoid this in the future?
In my make file for the server, there are the following flags for compiling the main program:
-I../include -L../lib -lA -lB -lC
Each shared library uses next to the checkboxes for the shared library and does not use -fPIC.
source
share