-
-
Notifications
You must be signed in to change notification settings - Fork 0
Libraries
The ARIX shared libraries are regular .so files with few slight differences. In contrast to shared objects known from linux world they need to expose one symbol only - the library base. This must be a weak symbol with a name LibBase. The base contains information about library version and revision, contains a string identifying the object (in human readable form) as well as a pointer to the LVO table, similar to virtual function table from object oriented languages.
The LVO table contains pointers to the functions exposed by the library. The first four functions have to be always implemented and have following meaning:
struct Library * LibOpen(void * handle, uint32_t version)
The function is called when the library is opened by an application after it has been loaded. It receives two parameters, the handle to the unterlying .so object as it was received from libdl and the requested library version. The LibOpen code shall store the handle for later use and should make sure the LVO table fulfulls requirements of requested library version and do whatever it needs to do before the library is opened. The function returns a pointer to struct Library.
The library is allowed to return a different library base than the one which is exported (e.g. if, due to version change, the offsets within LVO table have changed).
void * LibClose()
The function is called during CloseLibrary() call. Library code should eventually clean things up (e.g. close opened files) and it should return the handle to underlying .so object back.
void * LibExpunge()
Kept for historical reasons, currently unused.
void * GetHandle()
Return the handle to the .so object without performing any additional action. This call is used by exec's function GetSymbolAddress.