dllqueryfn() — Obtain a pointer to a dynamic link library function

Standards

Standards / Extensions C or C++ Dependencies
C Library both  

Format

#include <dll.h>

void (*dllqueryfn(dllhandle *dllHandle, const char *funcName))();

General description

Note: This function is deprecated; use dlsym() instead.

Obtains a pointer to a dynamic link library (DLL) function (funcName). It uses the dllHandle returned from a previous successful call to dllload() for input. funcName represents the name of an exported function from the DLL. It must be a character string terminated with the NULL character.

This function is not available under the SPC, MTF, and CSP environments.

Returned value

If successful, dllqueryfn() returns a pointer to a function, funcName, that can be used to invoke the desired function in a DLL.

If unsuccessful, dllqueryfn() returns NULL and sets errno.

Usage notes

  1. More detailed diagnostic information is available through the _EDC_DLL_DIAG environment variable, and the Language Environment® DLL Failure control block (CEEDLLF) chain.

Example

CELEBDL2
⁄* CELEBDL2

   The following example shows how to use dllqueryfn() to obtain
   a pointer to a function, f1 that is in DLL load module stream.

 *⁄
#include <stdio.h>
#include <dll.h>

main() {
    dllhandle *handle;
    char *name="stream";
    int (*fptr1)();

    handle = dllload(name);
    if (handle == NULL) {
       perror("failed on dllload of stream DLL");
       exit(-1);
    }

    fptr1 = (int (*)()) dllqueryfn(handle,"f1");
    if (fptr1 == NULL) {
       perror("failed on retrieving f1 function");
       exit (-2);
    }
}

Related information