Ignore:
Timestamp:
Jul 18, 2012, 9:37:38 PM (13 years ago)
Author:
dmik
Message:

Make sure BEGINLIBPATH is not necessary when loading JVM.

BEGINLIBPATH is not necessary at all now: neither when loading the JVM
with standard launchers (like java.exe) nor when doing JVM.DLL directly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk/hotspot/src/os/os2/vm/os_os2_init.cpp

    r346 r395  
    2828// the Windows DllMain() and registers the DLL with Odin
    2929
     30#define INCL_DOS
     31#define INCL_ERRORS
    3032#include <os2wrap.h> // Odin32 OS/2 api wrappers
    3133#include <odinlx.h>
     
    3638#include <emx/startup.h>
    3739#endif
     40
     41#include <string.h>
    3842
    3943extern "C" BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved);
     
    7276        CheckVersionFromHMOD(PE2LX_VERSION, hModule);
    7377
     78        // Assuming that JVM.DLL is stored in a bin/<type>/ subdirectory (where
     79        // type is e.g. "client"), we add this directory, as well as its parent
     80        // (which contains all other Java DLLs), to BEGINLIBPATH so that the OS2
     81        // DLL loader can satisfy DLL dependencies (i.e. find DLLs referred to
     82        // by other DLLs through their import module table) when some Java DLLs
     83        // (e.g. JAVA.DLL, JZIP.DLL) are dynamically loaded later by JVM.DLL.
     84        // Note that despite the fact that JVM.DLL is already loaded at this
     85        // point, we still need to add its directory to BEGINLIBPATH. This is
     86        // bcause most likely it's been loaded by full path which does NOT make
     87        // it locatable by the loader when referred to by name from the import
     88        // table of some other DLL (like JAVA.DLL).
     89
     90        char dllpath[CCHMAXPATH + 16 /* ";%BEGINLIBPATH%" */];
     91        if (DosQueryModuleName(hModule, sizeof(dllpath), dllpath) == NO_ERROR)
     92        {
     93            char *end = strrchr(dllpath, '\\');
     94            if (end)
     95            {
     96                strcpy(end, ";%BEGINLIBPATH%");
     97                DosSetExtLIBPATH(dllpath, BEGIN_LIBPATH);
     98                end = strrchr(dllpath, '\\');
     99                if (end)
     100                {
     101                    strcpy(end, ";%BEGINLIBPATH%");
     102                    DosSetExtLIBPATH(dllpath, BEGIN_LIBPATH);
     103                }
     104            }
     105        }
     106
    74107#ifdef ODIN_FORCE_WIN32_TIB
    75108        // enable __try/__except support
Note: See TracChangeset for help on using the changeset viewer.