gtpc2m1p | C/C++ Language Support User's Guide |
This function obtains a pointer to a dynamic link library (DLL) variable.
Format
#include <dll.h> void* dllqueryvar(dllhandle *dllHandle, char *varName);
The dllHandle was obtained previously by a successful dllload function call.
Normal Return
The dllqueryvar function returns a pointer to a variable in the storage of the DLL if the call is successful.
Error Return
When the call is not successful, the dllqueryvar function returns NULL and sets errno.
Programming Considerations
None.
Examples
The following example shows how to use the dllqueryvar function to obtain a pointer to variable var1, which is in DLL load module DLLB.
#include <stdio.h> #include <dll.h> int main(void) { dllhandle *handle; char *name="DLLB"; int *ptr1_var1; handle = dllload(name); if (handle == NULL) { printf("failed on dllload of DLLB DLL\n"); exit (-1); } ptr_var1 = dllqueryvar(handle,"var1"); if (ptr_var1 == NULL) { printf("failed on retrieving var1 variable\n"); exit (-3); } }
Related Information