1365 // in case of error it checks if .dll/.so was built for the |
1365 // in case of error it checks if .dll/.so was built for the |
1366 // same architecture as Hotspot is running on |
1366 // same architecture as Hotspot is running on |
1367 void * os::dll_load(const char *name, char *ebuf, int ebuflen) { |
1367 void * os::dll_load(const char *name, char *ebuf, int ebuflen) { |
1368 void * result = LoadLibrary(name); |
1368 void * result = LoadLibrary(name); |
1369 if (result != NULL) { |
1369 if (result != NULL) { |
|
1370 Events::log(NULL, "Loaded shared library %s", name); |
1370 // Recalculate pdb search path if a DLL was loaded successfully. |
1371 // Recalculate pdb search path if a DLL was loaded successfully. |
1371 SymbolEngine::recalc_search_path(); |
1372 SymbolEngine::recalc_search_path(); |
1372 return result; |
1373 return result; |
1373 } |
1374 } |
1374 |
|
1375 DWORD errcode = GetLastError(); |
1375 DWORD errcode = GetLastError(); |
|
1376 // Read system error message into ebuf |
|
1377 // It may or may not be overwritten below (in the for loop and just above) |
|
1378 lasterror(ebuf, (size_t) ebuflen); |
|
1379 ebuf[ebuflen - 1] = '\0'; |
|
1380 Events::log(NULL, "Loading shared library %s failed, error code %lu", name, errcode); |
|
1381 |
1376 if (errcode == ERROR_MOD_NOT_FOUND) { |
1382 if (errcode == ERROR_MOD_NOT_FOUND) { |
1377 strncpy(ebuf, "Can't find dependent libraries", ebuflen - 1); |
1383 strncpy(ebuf, "Can't find dependent libraries", ebuflen - 1); |
1378 ebuf[ebuflen - 1] = '\0'; |
1384 ebuf[ebuflen - 1] = '\0'; |
1379 return NULL; |
1385 return NULL; |
1380 } |
1386 } |
1382 // Parsing dll below |
1388 // Parsing dll below |
1383 // If we can read dll-info and find that dll was built |
1389 // If we can read dll-info and find that dll was built |
1384 // for an architecture other than Hotspot is running in |
1390 // for an architecture other than Hotspot is running in |
1385 // - then print to buffer "DLL was built for a different architecture" |
1391 // - then print to buffer "DLL was built for a different architecture" |
1386 // else call os::lasterror to obtain system error message |
1392 // else call os::lasterror to obtain system error message |
1387 |
|
1388 // Read system error message into ebuf |
|
1389 // It may or may not be overwritten below (in the for loop and just above) |
|
1390 lasterror(ebuf, (size_t) ebuflen); |
|
1391 ebuf[ebuflen - 1] = '\0'; |
|
1392 int fd = ::open(name, O_RDONLY | O_BINARY, 0); |
1393 int fd = ::open(name, O_RDONLY | O_BINARY, 0); |
1393 if (fd < 0) { |
1394 if (fd < 0) { |
1394 return NULL; |
1395 return NULL; |
1395 } |
1396 } |
1396 |
1397 |