Qp2dlopen()--Dynamically Load an IBM PASE for i Module


  Syntax
 #include <qp2user.h>

 QP2_ptr64_t Qp2dlopen(const char  *path,
                       int         flags,
                       int         ccsid);  

  Service Program Name: QP2USER

  Default Public Authority: *USE

  Threadsafe: Yes

Qp2dlopen() dynamically loads an IBM® i PASE module by calling the IBM PASE for i dlopen() function.


Parameters

path
(Input) A pointer to a null-terminated string that identifies the stream file in the Integrated File System that contains the IBM PASE for i module to load. This API copies the input path string and converts the copy from the CCSID specified by the ccsid argument to the current IBM PASE for i CCSID (required by the IBM PASE for i dlopen function).

If the input path pointer is null, the function result is a value for the main application that lets you find symbols in the IBM PASE for i process global name space, which includes all symbols exported by the IBM PASE for i program and shared executables except those loaded by IBM PASE for i dlopen using option RTLD_LOCAL.



flags
(Input) Flags passed to the IBM PASE for i dlopen function to control its behavior. These constants, declared in qp2user.h, match constants in AIX® header dlfcn.h (without the leading prefix, QP2_) and can be ORed together for the flags argument:

QP2_RTLD_NOW (0x00000002) Load all dependents of the module being loaded and resolve all symbols. Either QP2_RTLD_NOW or QP2_RTLD_LAZY must be specified.

QP2_RTLD_LAZY (0x00000004) Allow the system to defer loading dependent modules. Either QP2_RTLD_NOW or QP2_RTLD_LAZY must be specified.

QP2_RTLD_GLOBAL (0x00010000) Load the module into the global name space. Exported symbols in the module will be visible in the main application and will be used when resolving symbols used by other IBM PASE for i dlopen calls.

QP2_RTLD_LOCAL (0x00080000) Load the module into a local name space. This option is the default when neither QP2_RTLD_GLOBAL nor QP2_RTLD_LOCAL is specified. It prevents symbols in the module being loaded from being used when resolving symbols used by other dlopen calls.

QP2_RTLD_MEMBER (0x00040000) Specifies that the path argument string may contain the name of a member in an archive (shared library).

QP2_RTLD_NOAUTODEFER (0x00020000) Prevent deferred imports in the module being loaded from being automatically resolved by subsequent loads.


ccsid
(Input) Specifies the CCSID for the input path argument string. Zero means the path is in the (EBCDIC) job default CCSID.

Authorities

Object Referred to Authority
Required
Each directory in the path to the IBM PASE for i module *X
IBM PASE for i module *R

Return Value

Sucessful completion returns a non-zero function result that can be used to call APIs Qp2dlsym and Qp2dlclose (and also IBM PASE for i functions dlsym and dlclose). Resources allocated for the function result are not freed until the IBM PASE for i program ends or the value is passed to API Qp2dlclose (or IBM PASE for i dlclose).

A zero function result indicates an error. The caller can check ILE errno or IBM PASE for i errno (if ILE errno is zero), or call the Qp2dlerror API for more information about the error.


Related Information



API introduced: V5R2

[ Back to top | IBM PASE for i APIs | APIs by category ]