mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
Added support for Python 3. (Roland Puntaier)
This commit is contained in:
@@ -96,6 +96,19 @@ struct PyMethodDef { Py_ssize_t a; };
|
||||
# define HINSTANCE long_u /* for generating prototypes */
|
||||
# endif
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <dlfcn.h>
|
||||
# define FARPROC void*
|
||||
# define HINSTANCE void*
|
||||
# define load_dll(n) dlopen((n),RTLD_LAZY)
|
||||
# define close_dll dlclose
|
||||
# define symbol_from_dll dlsym
|
||||
#else
|
||||
# define load_dll LoadLibrary
|
||||
# define close_dll FreeLibrary
|
||||
# define symbol_from_dll GetProcAddress
|
||||
#endif
|
||||
|
||||
/* This makes if_python.c compile without warnings against Python 2.5
|
||||
* on Win32 and Win64. */
|
||||
#undef PyRun_SimpleString
|
||||
@@ -315,7 +328,7 @@ end_dynamic_python(void)
|
||||
{
|
||||
if (hinstPython)
|
||||
{
|
||||
FreeLibrary(hinstPython);
|
||||
close_dll(hinstPython);
|
||||
hinstPython = 0;
|
||||
}
|
||||
}
|
||||
@@ -332,7 +345,7 @@ python_runtime_link_init(char *libname, int verbose)
|
||||
|
||||
if (hinstPython)
|
||||
return OK;
|
||||
hinstPython = LoadLibrary(libname);
|
||||
hinstPython = load_dll(libname);
|
||||
if (!hinstPython)
|
||||
{
|
||||
if (verbose)
|
||||
@@ -342,10 +355,10 @@ python_runtime_link_init(char *libname, int verbose)
|
||||
|
||||
for (i = 0; python_funcname_table[i].ptr; ++i)
|
||||
{
|
||||
if ((*python_funcname_table[i].ptr = GetProcAddress(hinstPython,
|
||||
if ((*python_funcname_table[i].ptr = symbol_from_dll(hinstPython,
|
||||
python_funcname_table[i].name)) == NULL)
|
||||
{
|
||||
FreeLibrary(hinstPython);
|
||||
close_dll(hinstPython);
|
||||
hinstPython = 0;
|
||||
if (verbose)
|
||||
EMSG2(_(e_loadfunc), python_funcname_table[i].name);
|
||||
|
Reference in New Issue
Block a user