Jump to content

DosQueryExtLIBPATH: Difference between revisions

From EDM2
Created page with "==Description== Returns the current path to be searched before or after the system LIBPATH when locating DLLs. ==Syntax== <PRE> #define INCL_DOSMISC #include <os2.h> PSZ ..."
 
Ak120 (talk | contribs)
(No difference)

Revision as of 08:47, 10 January 2017

Description

Returns the current path to be searched before or after the system LIBPATH when locating DLLs.

Syntax

#define INCL_DOSMISC
#include <os2.h>

PSZ       pszExtLIBPATH;  /*  Extended LIBPATH string. */
ULONG     flags;          /*  Flag indicating when the new path is searched. */
APIRET    ulrc;           /*  Return Code. */

ulrc = DosQueryExtLIBPATH(pszExtLIBPATH, flags);

Parameters

pszExtLIBPATH (PSZ) - output
Extended LIBPATH string.

If the buffer pointed to by this parameter is not large enough to hold the extended LIBPATH or an extended LIBPATH is not currently defined, this parameter returns a pointer to a NULL string.

flags (ULONG) - output
Flag indicating when the new path is searched.

Possible values are described in the following list:

BEGIN_LIBPATH
       The new path is searched before the LIBPATH. 

END_LIBPATH
       The new path is searched after the LIBPATH.

Return Code

ulrc (APIRET) - returns

DosQueryExtLIBPATH returns one of the following values:

  • 0 NO_ERROR
  • 87 ERROR_INVALID_PARAMETER
  • 122 ERROR_INSUFFICIENT_BUFER

Remarks

Example Code

This example updates the paths to be searched before and after the system LIBPATH, when locating a DLL.

 #define INCL_DOSMISC
 #define INCL_DOSERRORS
 #include <os2.h>
 #include <stdio.h>

 int main(VOID) {

 UCHAR   uchBeginLIBPATH[512] = "";       /* Begin LIBPATH value returned */
 UCHAR   uchEndLIBPATH[512]   = "";       /* End LIBPATH value returned   */
 APIRET  rc                   = NO_ERROR;    /* Return code               */

    rc = DosSetExtLIBPATH("C:\\TOOL_X\\VERS_20\\DLL",
                          BEGIN_LIBPATH);    /* Add to beginning LIBPATH */
    if (rc != NO_ERROR) {
        printf("DosSetExtLIBPATH error: return code = %u\n", rc);
        return 1;
    }

    rc = DosSetExtLIBPATH("C:\\TOOL_X\\VERS_10\\DLL",
                          END_LIBPATH);      /* Add to ending LIBPATH   */
    if (rc != NO_ERROR) {
        printf("DosSetExtLIBPATH error: return code = %u\n", rc);
        return 1;
    }

    rc = DosQueryExtLIBPATH(uchBeginLIBPATH,
                            BEGIN_LIBPATH);   /* Query the BeginLIBPATH */
    if (rc != NO_ERROR) {
        printf("DosQueryExtLIBPATH error: return code = %u\n", rc);
        return 1;
    }

    rc = DosQueryExtLIBPATH(uchEndLIBPATH,
                            END_LIBPATH);     /* Query the EndLIBPATH   */
    if (rc != NO_ERROR) {
        printf("DosQueryExtLIBPATH error: return code = %u\n", rc);
        return 1;
    }

    printf(" BeginLIBPATH = %s\n", uchBeginLIBPATH);
    printf("   EndLIBPATH = %s\n", uchEndLIBPATH);

  return NO_ERROR;
}


Related Functions