TAPI for remote calls of dynamic linking loader
Overview
// typedefs typedef int64_t rpc_dlhandle; typedef int64_t rpc_dlsymaddr; // global functions rpc_dlhandle rpc_dlopen(rcf_rpc_server* rpcs, const char* filename, int flags); char* rpc_dlerror(rcf_rpc_server* rpcs); rpc_dlsymaddr rpc_dlsym(rcf_rpc_server* rpcs, rpc_dlhandle handle, const char* symbol); int rpc_dlsym_call(rcf_rpc_server* rpcs, rpc_dlhandle handle, const char* symbol); int rpc_dlclose(rcf_rpc_server* rpcs, rpc_dlhandle handle); // macros #define RPC_DLHANDLE_NULL #define RPC_DLSYM_NULL
Detailed Documentation
Global Functions
rpc_dlhandle rpc_dlopen(rcf_rpc_server* rpcs, const char* filename, int flags)
Loads the dynamic labrary file.
Parameters:
rpcs |
RPC server handle |
filename |
the name of the file to load |
flags |
dlopen flags |
Returns:
dynamic library handle on success or NULL in the case of failure
char* rpc_dlerror(rcf_rpc_server* rpcs)
Returns a human readable string describing the most recent error that occurred from dlopen(), dlsym() or dlclose().
Parameters:
rpcs |
RPC server handle |
Returns:
a pointer to string or NULL if no errors occurred.
rpc_dlsymaddr rpc_dlsym(rcf_rpc_server* rpcs, rpc_dlhandle handle, const char* symbol)
Returns the address where a certain symbol from dynamic library is loaded into memory.
Parameters:
rpcs |
RPC server handle |
handle |
handle of a dynamic library returned by dlopen() |
symbol |
null-terminated symbol name |
Returns:
address of the symbol or NULL if symbol is not found.
int rpc_dlsym_call(rcf_rpc_server* rpcs, rpc_dlhandle handle, const char* symbol)
Calls a certain function without arguments from dynamic labrary.
Parameters:
rpcs |
RPC server handle |
handle |
handle of a dynamic library returned by dlopen() |
symbol |
null-terminated symbol name |
Returns:
return code of function.
int rpc_dlclose(rcf_rpc_server* rpcs, rpc_dlhandle handle)
Decrements the reference count on the dynamic library handle. If the reference count drops to zero and no other loaded libraries use symbols in it, then the dynamic library is unloaded.
Parameters:
rpcs |
RPC server handle |
handle |
handle of a dynamic library returned by dlopen() |
Returns:
0 on success, and non-zero on error.