Commit 22f221752d1bdbfd9b88f1dca3733bb23353f04b
1 parent
93eaf5fe
Exists in
master
Working on windows package.
Showing
4 changed files
with
24 additions
and
11 deletions
Show diff stats
setup.py
@@ -11,8 +11,8 @@ if platform.system() == 'Windows': | @@ -11,8 +11,8 @@ if platform.system() == 'Windows': | ||
11 | tn3270 = Extension( | 11 | tn3270 = Extension( |
12 | 'tn3270', | 12 | 'tn3270', |
13 | define_macros = [ | 13 | define_macros = [ |
14 | - ('PACKAGE_NAME', '\"python3-tn3270\"'), | ||
15 | - ('PACKAGE_VERSION', '\"5.2\"') | 14 | + ('TN3270_MODULE_NAME', 'python3-tn3270'), |
15 | + ('TN3270_MODULE_VERSION', '5.2') | ||
16 | ], | 16 | ], |
17 | include_dirs = include_dirs, | 17 | include_dirs = include_dirs, |
18 | libraries = ['ipc3270'], | 18 | libraries = ['ipc3270'], |
src/module/init.c
@@ -41,14 +41,14 @@ static PyMethodDef methods[] = { | @@ -41,14 +41,14 @@ static PyMethodDef methods[] = { | ||
41 | "version", | 41 | "version", |
42 | py3270_get_module_version, | 42 | py3270_get_module_version, |
43 | METH_NOARGS, | 43 | METH_NOARGS, |
44 | - "Get " PACKAGE_NAME " version" | 44 | + "Get package version" |
45 | }, | 45 | }, |
46 | 46 | ||
47 | { | 47 | { |
48 | "revision", | 48 | "revision", |
49 | py3270_get_module_revision, | 49 | py3270_get_module_revision, |
50 | METH_NOARGS, | 50 | METH_NOARGS, |
51 | - "Get " PACKAGE_NAME " revision" | 51 | + "Get package revision" |
52 | 52 | ||
53 | }, | 53 | }, |
54 | 54 |
src/module/properties.cc
@@ -28,11 +28,14 @@ | @@ -28,11 +28,14 @@ | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <py3270.h> | 30 | #include <py3270.h> |
31 | + #include <lib3270.h> | ||
31 | 32 | ||
32 | /*---[ Implement ]----------------------------------------------------------------------------------*/ | 33 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
33 | 34 | ||
34 | PyObject * py3270_get_module_version(PyObject *self, PyObject *args) { | 35 | PyObject * py3270_get_module_version(PyObject *self, PyObject *args) { |
35 | -#ifdef PACKAGE_VERSION | 36 | +#if defined(TN3270_MODULE_VERSION) |
37 | + return PyUnicode_FromString(LIB3270_STRINGIZE_VALUE_OF(TN3270_MODULE_VERSION)); | ||
38 | +#elif defined(PACKAGE_VERSION) | ||
36 | return PyUnicode_FromString(PACKAGE_VERSION); | 39 | return PyUnicode_FromString(PACKAGE_VERSION); |
37 | #else | 40 | #else |
38 | return PyUnicode_FromString(""); | 41 | return PyUnicode_FromString(""); |
src/module/windows/init.cc
@@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
38 | 38 | ||
39 | #include <py3270.h> | 39 | #include <py3270.h> |
40 | 40 | ||
41 | - #if defined(_WIN32) && defined(USING_STATIC_IPC3270) | 41 | + #if defined(_WIN32) |
42 | 42 | ||
43 | #include <lmcons.h> | 43 | #include <lmcons.h> |
44 | #include <delayimp.h> | 44 | #include <delayimp.h> |
@@ -47,10 +47,15 @@ | @@ -47,10 +47,15 @@ | ||
47 | #include <stdexcept> | 47 | #include <stdexcept> |
48 | #include <lib3270.h> | 48 | #include <lib3270.h> |
49 | 49 | ||
50 | + #if defined(_MSC_VER) | ||
51 | + #pragma comment(lib,"DelayImp.lib") | ||
52 | + #pragma comment(lib,"Advapi32.lib") | ||
53 | + #endif // _MSC_VER | ||
54 | + | ||
50 | extern "C" { | 55 | extern "C" { |
51 | 56 | ||
52 | - extern __declspec (dllexport) PfnDliHook __pfnDliNotifyHook2; | ||
53 | - extern __declspec (dllexport) PfnDliHook __pfnDliFailureHook2; | 57 | +// extern __declspec (dllexport) PfnDliHook __pfnDliNotifyHook2; |
58 | +// extern __declspec (dllexport) PfnDliHook __pfnDliFailureHook2; | ||
54 | 59 | ||
55 | FARPROC WINAPI py3270_delay_load_hook(unsigned reason, DelayLoadInfo * info); | 60 | FARPROC WINAPI py3270_delay_load_hook(unsigned reason, DelayLoadInfo * info); |
56 | 61 | ||
@@ -62,8 +67,13 @@ | @@ -62,8 +67,13 @@ | ||
62 | 67 | ||
63 | // https://docs.microsoft.com/en-us/cpp/build/reference/loading-all-imports-for-a-delay-loaded-dll?view=vs-2019 | 68 | // https://docs.microsoft.com/en-us/cpp/build/reference/loading-all-imports-for-a-delay-loaded-dll?view=vs-2019 |
64 | 69 | ||
65 | - PfnDliHook __pfnDliNotifyHook2 = py3270_delay_load_hook; | ||
66 | - PfnDliHook __pfnDliFailureHook2 = py3270_delay_load_hook; | 70 | + #if defined(_MSC_VER) |
71 | + const PfnDliHook __pfnDliNotifyHook2 = py3270_delay_load_hook; | ||
72 | + const PfnDliHook __pfnDliFailureHook2 = py3270_delay_load_hook; | ||
73 | + #else | ||
74 | + PfnDliHook __pfnDliNotifyHook2 = py3270_delay_load_hook; | ||
75 | + PfnDliHook __pfnDliFailureHook2 = py3270_delay_load_hook; | ||
76 | + #endif // _MSC_VER | ||
67 | 77 | ||
68 | static HANDLE hModule = 0; | 78 | static HANDLE hModule = 0; |
69 | static HANDLE hEventLog = 0; | 79 | static HANDLE hEventLog = 0; |
@@ -189,5 +199,5 @@ | @@ -189,5 +199,5 @@ | ||
189 | 199 | ||
190 | } | 200 | } |
191 | 201 | ||
192 | - #endif // USING_STATIC_IPC3270 | 202 | + #endif // _WIN32 |
193 | 203 |