tpsvrinit — Template for server init function
#include <atmi.h>
int tpsvrinit (int argc, char **argv);
For XATMI server link with -latmisrv|-latmisrvnomain|-latmisrvinteg -latmi -lubf -lnstd -lpthread -lrt -lm
This function is called upon server startup. Before the services are advertise, this function is activated. The argc and argv is command line parameters passed to binary after the --. Initial parameters are used by Enduro/X, these are sys-opts in the ndrxconfig.xml, after the -- those are application specific options.
Normally at tpsvrinit() XATMI server does the tpadvertise(), and initialize other resources, like calling tpopen(). Any advertise done here, actually takes a part when function returns.
The function can be exposed to Enduro/X system in different ways:
Library atmisrvinteg provides built in version of tpsvrinit() function. Function may be used only if starting server with _tmstartserver(3) (or was built by buildserver(8)). The default tpsvrinit() function, in case if application was not built for multi-threading (extern variable _tmbuilt_with_thread_option set to 0 or buildserver -t not set), calls tpsvrthrinit(3) from the tmsvrargs_t. In case there were no tpsvrthrinit(3) provided, the default tpsvrthrinit() is used also from atmisrvinteg library. The default version of tpsvrthrinit(3) calls tx_open(3).
This only applies to XATMI servers.
In case if using C++ compiler, function must be defined without name mangling, thus extern "C" prefix shall be used.