return (handle);
}
+static void
+dld_finalize (void * handle)
+{
+ void * address = (dlsym (handle, "dld_finalize_file"));
+ if (address != 0)
+ {
+ void (*finalize) (void) = address;
+ (*finalize) ();
+ }
+}
+
static void
dld_unload (void * handle)
{
+ dld_finalize (handle);
if ((dlclose (handle)) != 0)
{
SCHEME_OBJECT v = (allocate_marked_vector (TC_VECTOR, 3, 1));
void ** scan = loaded_handles;
void ** end = (scan + n_loaded_handles);
while (scan < end)
- dlclose (*scan++);
+ {
+ void * handle = (*scan++);
+ dld_finalize (handle);
+ dlclose (handle);
+ }
OS_free (loaded_handles);
loaded_handles_size = 0;
const char *
dload_initialize_file (void)
{
-
dload_initialize_x11base ();
dload_initialize_x11color ();
dload_initialize_x11graph ();
return ("#prx11");
}
+extern void dload_finalize_x11base (void);
+
+void
+dload_finalize_file (void)
+{
+ dload_finalize_x11base ();
+}
+
#endif /* defined (COMPILE_AS_MODULE) */
(x_error_info.code) = 0;
XSetErrorHandler (x_error_handler);
XSetIOErrorHandler (x_io_error_handler);
+#ifndef COMPILE_AS_MODULE
add_reload_cleanup (x_close_all_displays);
+#endif
initialization_done = 1;
}
declare_primitive ("X-WINDOW-Y-SIZE", Prim_x_window_y_size, 1, 1, 0);
}
+void
+dload_finalize_x11base (void)
+{
+ if (initialization_done)
+ x_close_all_displays ();
+}
+
#endif /* defined (COMPILE_AS_MODULE) */