Skip to content

Commit 7e285eb

Browse files
committed
Try to fix Windows
1 parent 263d418 commit 7e285eb

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/staticdata.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,9 +2473,18 @@ JL_DLLEXPORT jl_value_t *jl_restore_system_image_data(const char *buf, size_t le
24732473

24742474
JL_DLLEXPORT jl_value_t *jl_restore_package_image_from_file(const char *fname)
24752475
{
2476-
void *pkgimg_handle = dlopen(fname, RTLD_LAZY);
2477-
if (!pkgimg_handle)
2478-
jl_errorf("Error opening package file %s: %s\n", fname, dlerror());
2476+
void *pkgimg_handle = jl_dlopen(fname, JL_RTLD_LAZY);
2477+
if (!pkgimg_handle) {
2478+
#ifdef _OS_WINDOWS_
2479+
int err;
2480+
char reason[256];
2481+
err = GetLastError();
2482+
win32_formatmessage(err, reason, sizeof(reason));
2483+
#else
2484+
const char *reason = dlerror();
2485+
#endif
2486+
jl_errorf("Error opening package file %s: %s\n", fname, reason);
2487+
}
24792488
const char *pkgimg_data;
24802489
jl_dlsym(pkgimg_handle, "jl_system_image_data", (void **)&pkgimg_data, 1);
24812490
size_t *plen;

0 commit comments

Comments
 (0)