]> code.delx.au - gnu-emacs/commit
Improve MS-Windows implementation in dynlib.c
authorEli Zaretskii <eliz@gnu.org>
Fri, 20 Nov 2015 11:34:15 +0000 (13:34 +0200)
committerEli Zaretskii <eliz@gnu.org>
Fri, 20 Nov 2015 11:34:15 +0000 (13:34 +0200)
commit24be1c8460895ccec8a84e53966b324e35cac6c9
treea9c2112a0013bc30c8385c2a96caf0519a7a81c3
parentbd715e3d3d214f61172beb78f858ac43d8ce0a78
Improve MS-Windows implementation in dynlib.c

* src/dynlib.c [WINDOWSNT]: Include errno.h, lisp.h, and w32.h.
No need to include windows.h, as w32.h already does that.
<dynlib_last_err>: New static variable.
(dynlib_reset_last_error): New function.
(dynlib_open): Convert forward slashes to backslashes.  Convert
file names from UTF-8 to either UTF-16 or the current ANSI
codepage, and call either LoadLibraryW or LoadLibraryA.  If the
argument is NULL, return a handle to the main module, like
'dlopen' does.  Record the error, if any, for use by dynlib_error.
(dynlib_sym): Check the handle for validity. Record the error, if
any, for use by dynlib_error.
(dynlib_error): Call w32_strerror to produce the error string, and
zero out the last error code, like dlerror does.
(dynlib_close): Check the handle for validity.  Record the error,
if any, for use by dynlib_error.  Don't call FreeLibrary with a
handle for the main module.
* src/w32.c (globals_of_w32): Call dynlib_reset_last_error.
src/dynlib.c
src/w32.c