aboutsummaryrefslogtreecommitdiffstats
path: root/src/dynlib.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Rework C source files to avoid ^(Paul Eggert2016-03-101-2/+2
| | | | | | | | Work around Bug#22884 by rewording comments and strings to avoid ‘(’ at the start of a line unless it starts a function. This change is a short-term hack; in the longer run we plan to fix cc-mode’s performance for C files that have ‘(’ at the start of a line in a comment or string.
* Update copyright year to 2016Paul Eggert2016-01-011-1/+1
| | | | Run admin/update-copyright.
* Implement dynlib_addr for MS-WindowsEli Zaretskii2015-11-241-2/+114
| | | | | | | | | | | | * src/dynlib.c [WINDOWSNT]: Include w32common.h. <g_b_init_get_module_handle_ex> [WINDOWSNT]: New static variable. (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS) (GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT) [WINDOWSNT]: Define if undefined. (dynlib_reset_last_error): Reset g_b_init_get_module_handle_ex to zero. (dynlib_addr) [WINDOWSNT]: Non-trivial implementation to report the full file name of the module for a given address.
* Port better to FreeBSD’s dlfunc vs dlsymPaul Eggert2015-11-231-0/+10
| | | | | | | | | | | This avoids warnings when converting between void * and function pointers, which strict C11 does not allow. * configure.ac (dlfunc): Check for existence. * src/dynlib.c (dlfunc) [!HAVE_DLFUNC]: New macro. (dynlib_func): New function. * src/dynlib.h (dynlib_function_ptr, dynlib_func): New decls. * src/emacs-module.c (Fmodule_load): Use dynlib_func, not dynlib_sym, for function pointers.
* Improve MS-Windows implementation in dynlib.cEli Zaretskii2015-11-201-9/+95
| | | | | | | | | | | | | | | | | | | | * 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.
* Include-file tweaks for modulesPaul Eggert2015-11-201-0/+2
| | | | | | | | | * src/dynlib.c, src/emacs-module.c: Include <config.h> first. * src/dynlib.h: Do not include config.h. It’s every .c file’s responsibility to include config.h first. * src/emacs-module.c: Include emacs-module.h immediately after config.h, to test that emacs-module.h doesn’t depend on include files other than config.h.
* Fix minor module problems found by static checkingPaul Eggert2015-11-191-0/+4
| | | | | | | * src/dynlib.c (dynlib_close): #ifdef out for now, as it’s not used. * src/eval.c, src/lisp.h (lisp_eval_depth): Now static. * src/module.c (Fmodule_load): Fix pointer signedness bug. (Fmodule_call): Tell GCC that the default case is unreachable.
* Style fixes for indenting etc. in module codePaul Eggert2015-11-191-19/+26
| | | | | | | This is mostly indenting and spacing changes. Also, remove some unnecessary static decls instead of bothering to reindent them. * src/module.h (EMACS_EXTERN_C_BEGIN): Remove, and do this inline, as most other Emacs files do for this sort of thing.
* Add copyright notices to module codePaul Eggert2015-11-191-9/+25
| | | | Put them in the usual format for GNU Emacs copyright notices.
* Add portable layer for dynamic loadingAurélien Aptel2015-11-181-0/+93
* src/dynlib.h: New file. * src/dynlib.c: New file. Co-authored-by: Philipp Stephani <phst@google.com>