Initialize the SDK
In your main function, call these initialization functions:
- Initialize the
configstructure as shown in the previous section. - Initialize the SDK by passing the configuration structure to
appd_sdk_init().
If appd_sdk_init() returns zero, the SDK is initialized successfully.
Non-zero indicates failure because the SDK could not reach the Controller.
The following example illustrates how to initialize the SDK:
int initRC = appd_sdk_init(cfg);
if (initRC) {
std::cerr << "Error: sdk init: " << initRC << std::endl;
return -1;
}
appd_sdk_init() and
fork() should only occur in the forked process, never in the parent
process. Each child call should behave independently and cannot share handles between the
process and other SDK-instrumented child processes.