--- a/ObjectFileLoader.st Tue Feb 11 17:51:19 2020 +0100
+++ b/ObjectFileLoader.st Thu Feb 13 15:18:46 2020 +0100
@@ -3411,58 +3411,58 @@
%{ /* CALLSUNLIMITEDSTACK(noWIN32) */
#ifdef GNU_DL
if (__isStringLike(sysHandle1)) {
- if (dld_unlink_by_file(__stringVal(sysHandle1), 1)) {
- if (@global(Verbose) == true) {
- console_printf ("unlink file %s failed\n", __stringVal(sysHandle1));
- dld_perror("cant unlink");
- }
- RETURN (false);
- }
- RETURN (true);
+ if (dld_unlink_by_file(__stringVal(sysHandle1), 1)) {
+ if (@global(Verbose) == true) {
+ console_printf ("unlink file %s failed\n", __stringVal(sysHandle1));
+ dld_perror("cant unlink");
+ }
+ RETURN (false);
+ }
+ RETURN (true);
}
RETURN (false);
#endif
#ifdef WIN_DL
- INT val;
- HINSTANCE handle;
- int err;
- jmp_buf exitJmpBuf;
-
if (__bothSmallInteger(sysHandle1, sysHandle2)) {
+ INT val;
+ HINSTANCE handle;
+ int err;
+ jmp_buf exitJmpBuf;
+
# if __POINTER_SIZE__ == 8
- val = (_intVal(sysHandle2) << 32) + _intVal(sysHandle1);
+ val = (_intVal(sysHandle2) << 32) + _intVal(sysHandle1);
# else
- val = (_intVal(sysHandle2) << 16) + _intVal(sysHandle1);
+ val = (_intVal(sysHandle2) << 16) + _intVal(sysHandle1);
# endif
- handle = (HINSTANCE)(val);
-
- if (!setjmp(exitJmpBuf)) {
- __setAtExitLongJmp(exitJmpBuf);
- if (@global(Verbose) == true) {
- console_fprintf (stderr,
- "ObjectFileLoader [info]: FreeLibrary %s handle: %"_lx_"\n",
- __stringVal(sysHandle1), (INT)handle);
- }
- if (FreeLibrary(handle) != TRUE) {
- __setAtExitLongJmp(0);
- err = GetLastError();
- if (@global(Verbose) == true) {
- console_fprintf (stderr,
- "ObjectFileLoader [warning]: FreeLibrary %s failed; error: %x\n",
- __stringVal(sysHandle1), err);
- }
- @global(LastErrorNumber) = __MKINT(__WIN32_ERR(err));
- RETURN (false);
- } else {
- __setAtExitLongJmp(0);
- }
- } else {
- // arrive here if FreeLibrary does exit
- __setAtExitLongJmp(0);
- console_fprintf(stderr, "ObjectFileLoader [warning]: FreeLibrary called exit() - ignored\n");
- }
- RETURN (true);
+ handle = (HINSTANCE)(val);
+
+ if (setjmp(exitJmpBuf)) {
+ __setAtExitLongJmp(exitJmpBuf);
+ if (@global(Verbose) == true) {
+ console_fprintf (stderr,
+ "ObjectFileLoader [info]: FreeLibrary %s handle: %"_lx_"\n",
+ __stringVal(sysHandle1), (INT)handle);
+ }
+ if (FreeLibrary(handle) != TRUE) {
+ __setAtExitLongJmp(0);
+ err = GetLastError();
+ if (@global(Verbose) == true) {
+ console_fprintf (stderr,
+ "ObjectFileLoader [warning]: FreeLibrary %s failed; error: %x\n",
+ __stringVal(sysHandle1), err);
+ }
+ @global(LastErrorNumber) = __MKINT(__WIN32_ERR(err));
+ RETURN (false);
+ } else {
+ __setAtExitLongJmp(0);
+ }
+ } else {
+ // arrive here if FreeLibrary does exit
+ __setAtExitLongJmp(0);
+ console_fprintf(stderr, "ObjectFileLoader [warning]: FreeLibrary called exit() - ignored\n");
+ }
+ RETURN (true);
}
RETURN (false);
#endif
@@ -3475,18 +3475,18 @@
if (__bothSmallInteger(low, hi)) {
#if __POINTER_SIZE__ == 8
- val = (__intVal(hi) << 32) + __intVal(low);
+ val = (__intVal(hi) << 32) + __intVal(low);
#else
- val = (_intVal(hi) << 16) + _intVal(low);
+ val = (_intVal(hi) << 16) + _intVal(low);
#endif
- h = (void *)(val);
- if (@global(Verbose) == true)
- console_printf("close handle = %"_lx_"\n", (INT)h);
- if (dlclose(h) != 0) {
- console_fprintf(stderr, "dlclose failed with:<%s>\n", dlerror());
- RETURN (false);
- }
- RETURN (true);
+ h = (void *)(val);
+ if (@global(Verbose) == true)
+ console_printf("close handle = %"_lx_"\n", (INT)h);
+ if (dlclose(h) != 0) {
+ console_fprintf(stderr, "dlclose failed with:<%s>\n", dlerror());
+ RETURN (false);
+ }
+ RETURN (true);
}
}
#endif
@@ -3498,13 +3498,13 @@
OBJ low = sysHandle1, hi = sysHandle2;
if (__bothSmallInteger(low, hi)) {
- val = (_intVal(hi) << 16) + _intVal(low);
- h = (void *)(val);
- if (@global(Verbose) == true) {
- console_printf("close handle = %x\n", h);
- }
- dlclose(h);
- RETURN (true);
+ val = (_intVal(hi) << 16) + _intVal(low);
+ h = (void *)(val);
+ if (@global(Verbose) == true) {
+ console_printf("close handle = %x\n", h);
+ }
+ dlclose(h);
+ RETURN (true);
}
}
#endif
@@ -3516,13 +3516,13 @@
OBJ low = sysHandle1, hi = sysHandle2;
if (__bothSmallInteger(low, hi)) {
- val = (_intVal(hi) << 16) + _intVal(low);
- h = (void *)(val);
- if (@global(Verbose) == true) {
- console_printf("unload handle = %x\n", h);
- }
- shl_unload(h);
- RETURN (true);
+ val = (_intVal(hi) << 16) + _intVal(low);
+ h = (void *)(val);
+ if (@global(Verbose) == true) {
+ console_printf("unload handle = %x\n", h);
+ }
+ shl_unload(h);
+ RETURN (true);
}
}
#endif
@@ -3534,16 +3534,16 @@
OBJ low = sysHandle1, hi = sysHandle2;
if (__bothSmallInteger(low, hi)) {
- val = (_intVal(hi) << 16) + _intVal(low);
- h = (int *)(val);
- if (@global(Verbose) == true) {
- console_printf("unload handle = %x\n", h);
- }
- if ( unload(h) != 0) {
- console_fprintf(stderr, "unload failed\n");
- RETURN (false);
- }
- RETURN (true);
+ val = (_intVal(hi) << 16) + _intVal(low);
+ h = (int *)(val);
+ if (@global(Verbose) == true) {
+ console_printf("unload handle = %x\n", h);
+ }
+ if ( unload(h) != 0) {
+ console_fprintf(stderr, "unload failed\n");
+ RETURN (false);
+ }
+ RETURN (true);
}
}
#endif
@@ -3555,6 +3555,8 @@
#endif
%}.
^ false
+
+ "Modified: / 13-02-2020 / 15:18:03 / Stefan Vogel"
!
unloadDynamicObject:handle