[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MS-Windows build using Posix configury
From: |
Eli Zaretskii |
Subject: |
Re: MS-Windows build using Posix configury |
Date: |
Fri, 17 May 2013 21:43:47 +0300 |
> Date: Fri, 17 May 2013 20:40:45 +0300
> Sun-Java-System-SMTP-Warning: Lines longer than SMTP allows found and
> truncated.
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden
>
> > Looks like another good candidate for mentioning in INSTALL.MSYS.
>
> I'd rather we unload all the DLLs before we exit, to avoid such
> problems in the first place.
Like in the patch below. Can you try that? (I hope you still have
that libintl-8.dll somewhere which required libgcc_s_dw2-1.dll, and
can reinstate it at least for the purposes of testing this patch.)
=== modified file 'src/w32.c'
--- src/w32.c 2013-04-15 13:39:41 +0000
+++ src/w32.c 2013-05-17 18:39:41 +0000
@@ -7404,13 +7404,9 @@ sys_localtime (const time_t *t)
/* Try loading LIBRARY_ID from the file(s) specified in
Vdynamic_library_alist. If the library is loaded successfully,
- return the handle of the DLL, and record the filename in the
- property :loaded-from of LIBRARY_ID. If the library could not be
- found, or when it was already loaded (because the handle is not
- recorded anywhere, and so is lost after use), return NULL.
-
- We could also save the handle in :loaded-from, but currently
- there's no use case for it. */
+ return the handle of the DLL, and record the filename and the
+ handle in the property :loaded-from of LIBRARY_ID. If the library
+ could not be found, or when it was already loaded, return NULL. */
HMODULE
w32_delayed_load (Lisp_Object library_id)
{
@@ -7434,11 +7430,12 @@ w32_delayed_load (Lisp_Object library_id
DWORD len;
len = GetModuleFileNameA (library_dll, name, sizeof (name));
- found = Fcons (XCAR (dlls),
- (len > 0)
- /* Possibly truncated */
- ? make_specified_string (name, -1, len, 1)
- : Qnil);
+ found = list3 (XCAR (dlls),
+ ((len > 0)
+ /* Possibly truncated */
+ ? make_specified_string (name, -1, len, 1)
+ : Qnil),
+ XIL ((EMACS_INT)library_dll));
break;
}
}
@@ -7449,6 +7446,36 @@ w32_delayed_load (Lisp_Object library_id
return library_dll;
}
+/* Unload any dynamic libraries we loaded. Called at exit. */
+static void
+unload_dlls (void)
+{
+ Lisp_Object dyn_alist = Vdynamic_library_alist;
+
+ while (CONSP (dyn_alist))
+ {
+ Lisp_Object elt = XCAR (dyn_alist), sym = Qnil;
+ Lisp_Object loaded_from = Qnil;
+
+ if (CONSP (elt))
+ {
+ sym = XCAR (elt);
+ if (SYMBOLP (sym))
+ loaded_from = Fget (sym, QCloaded_from);
+ }
+
+ if (CONSP (loaded_from)
+ && CONSP (XCDR (XCDR (loaded_from)))
+ && INTEGERP (XCAR (XCDR (XCDR (loaded_from)))))
+ {
+ HANDLE lh = (HANDLE)XLI (XCAR (XCDR (XCDR (loaded_from))));
+
+ FreeLibrary (lh);
+ }
+ dyn_alist = XCDR (dyn_alist);
+ }
+}
+
void
check_windows_init_file (void)
@@ -7505,6 +7532,8 @@ term_ntproc (int ignored)
{
(void)ignored;
+ unload_dlls ();
+
term_timers ();
/* shutdown the socket interface if necessary */
- Re: MS-Windows build using Posix configury, (continued)
- Re: MS-Windows build using Posix configury, Dmitry Gutov, 2013/05/16
- Re: MS-Windows build using Posix configury, Eli Zaretskii, 2013/05/17
- Re: MS-Windows build using Posix configury, Dmitry Gutov, 2013/05/17
- Re: MS-Windows build using Posix configury, Eli Zaretskii, 2013/05/17
- Re: MS-Windows build using Posix configury, Dmitry Gutov, 2013/05/17
- Re: MS-Windows build using Posix configury, Eli Zaretskii, 2013/05/17
- Re: MS-Windows build using Posix configury, Dmitry Gutov, 2013/05/17
- Re: MS-Windows build using Posix configury, Eli Zaretskii, 2013/05/17
- Re: MS-Windows build using Posix configury, Dmitry Gutov, 2013/05/17
- Re: MS-Windows build using Posix configury, Eli Zaretskii, 2013/05/17
- Re: MS-Windows build using Posix configury,
Eli Zaretskii <=
- Re: MS-Windows build using Posix configury, Dmitry Gutov, 2013/05/17
- Re: MS-Windows build using Posix configury, Eli Zaretskii, 2013/05/18
- Re: MS-Windows build using Posix configury, Dmitry Gutov, 2013/05/18
- Re: MS-Windows build using Posix configury, Eli Zaretskii, 2013/05/18
- Re: MS-Windows build using Posix configury, Dmitry Gutov, 2013/05/18
- Re: MS-Windows build using Posix configury, Eli Zaretskii, 2013/05/18
- Re: MS-Windows build using Posix configury, Dmitry Gutov, 2013/05/18
- Re: MS-Windows build using Posix configury, Eli Zaretskii, 2013/05/18
- Re: MS-Windows build using Posix configury, Dmitry Gutov, 2013/05/18
- Re: MS-Windows build using Posix configury, Eli Zaretskii, 2013/05/18