Changeset 134


Ignore:
Timestamp:
Sep 2, 2010, 9:45:16 PM (15 years ago)
Author:
dmik
Message:

jdk: launchers: Make sure both <JRE>\bin and <JRE>\<jvmtype> are added to BEGINLIBPATH so that Java DLLs may be loaded by name (as this is how they are referred to in the import tables of other DLLs and EXEs linked to them statically).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk/jdk/src/windows/bin/java_md.c

    r117 r134  
    233233#if __WIN32OS2__
    234234    /*
    235      * Make sure that other DLLs statically linked to the Java VM DLL (so that
    236      * they refer to it as 'JVM' instead of the full path) are able to find it.
     235     * Add the JRE bin path to BEGINLIBPATH to make sure that other DLLs
     236     * statically linked to the various JRE DLLs (so that they refer to them by
     237     * name in the import tables) are able to find it. This is necessary because
     238     * on OS/2, loading a DLL by full path does NOT make it available for other
     239     * DLLs by name -- a normal procedure of searching it in LIBPATH and
     240     * BEGINLIBPATH/ENDLIBPATH is always performed in this case.
     241     */
     242    if (GetJREPath(crtpath, MAXPATHLEN)) {
     243        char *dir = (char *)malloc(strlen(crtpath) + 4 + 32);
     244        strcpy(dir, crtpath);
     245        strcat(dir, "\\bin;%BEGINLIBPATH%");
     246        if (_launcher_debug) {
     247             printf("Adding %s to BEGINLIBPATH\n", dir);
     248        }
     249        DosSetExtLIBPATH(dir, BEGIN_LIBPATH);
     250        free(dir);
     251    }
     252
     253    /*
     254     * Do the same for the Java VM DLL which is located in a separate directory.
    237255     */
    238256    char *jvmdir = (char *)malloc(strlen(jvmpath) + 1 + 32);
     
    240258    char *sep = strrchr(jvmdir, '\\');
    241259    if (sep) {
    242         *sep = '\0';
    243260        strcpy(sep, ";%BEGINLIBPATH%");
     261        if (_launcher_debug) {
     262             printf("Adding %s to BEGINLIBPATH\n", jvmdir);
     263        }
    244264        DosSetExtLIBPATH(jvmdir, BEGIN_LIBPATH);
    245265    }
Note: See TracChangeset for help on using the changeset viewer.