UDM_AGENT* UdmAgentInit(UDM_AGENT* Agent, UDM_ENV* Env, int id);
Allocates or initializes an UDM_AGENT variable (search session).
If Agent is a NULL pointer, the function allocates, initializes, and returns a new variable. Otherwise, the variable is initialized and the address of the variable is returned. If UdmAgentInit() allocates a new variable, it is freed when UdmAgentFree() is called to close search session.
Agent
Pointer to a variable of type UDM_AGENT.
Env
Pointer to a variable of type UDM_ENV, should be the address of an existing UDM_ENV structure. Before calling UdmAgentInit() you must previously call UdmEnvInit() to initialize the UDM_ENV structure.
id
Thread id - an unique positive integer for a multi-thread application, or 0 in a non-thread application.
Pointer to initialized UDM_AGENT variable on success, NULL there was insufficient memory to allocate a new variable.
Example 1. UdmAgentInit
example #1
UDM_AGENT *Agent; if (!(Agent= UdmAgentInit(NULL, Env, 0))) { printf('Fatal error: could not allocate Agent'); exit(1); } ... UdmAgentFree(Agent);