gtpc2m1nC/C++ Language Support User's Guide

dllload-Load the DLL and Connect It to the Application

This function loads the dynamic link library (DLL) into memory (if it has not been loaded previously) and connects the DLL to the application program. The function that called the DLL receives a handle that uniquely identifies the requested DLL for subsequent explicit requests for that DLL.

A different handle is returned for each successful call to the dllload. A DLL is physically loaded only once even though there may be many calls to the dllload function.

Format

#include <dll.h>
dllhandle* dllload(char * dllName);

dllName
A pointer to the character string ending with the NULL (\0) character identifying the 4-character name of the DLL load module to be loaded.

Normal Return

The dllload function returns a unique handle that identifies the DLL when the call is successful.

Error Return

When the call is not successful, the dllload function returns NULL and sets errno.

Programming Considerations

None.

Examples

The following example shows how to call C dllload functions from a simple C application.

#include <stdio.h>
#include <dll.h>
 
int DLLA(void) {
  dllhandle *handle;
  char *name="DLLB";
 
  handle = dllload(name);
    if (handle == NULL) {
      printf("failed on dllload of DLLB DLL\n");
      exit (-1);
    }
}

Related Information