Show More
@@ -23,7 +23,6 b' int strcpy_s(char *d, size_t n, const ch' | |||||
23 | } |
|
23 | } | |
24 | #endif |
|
24 | #endif | |
25 |
|
25 | |||
26 |
|
||||
27 | static char pyscript[MAX_PATH + 10]; |
|
26 | static char pyscript[MAX_PATH + 10]; | |
28 | static char pyhome[MAX_PATH + 10]; |
|
27 | static char pyhome[MAX_PATH + 10]; | |
29 | static char envpyhome[MAX_PATH + 10]; |
|
28 | static char envpyhome[MAX_PATH + 10]; | |
@@ -40,11 +39,10 b' int main(int argc, char *argv[])' | |||||
40 | HANDLE hfind; |
|
39 | HANDLE hfind; | |
41 | const char *err; |
|
40 | const char *err; | |
42 | HMODULE pydll; |
|
41 | HMODULE pydll; | |
43 |
void |
|
42 | void(__cdecl * Py_SetPythonHome)(char *home); | |
44 |
int |
|
43 | int(__cdecl * Py_Main)(int argc, char *argv[]); | |
45 |
|
44 | |||
46 | if (GetModuleFileName(NULL, pyscript, sizeof(pyscript)) == 0) |
|
45 | if (GetModuleFileName(NULL, pyscript, sizeof(pyscript)) == 0) { | |
47 | { |
|
|||
48 | err = "GetModuleFileName failed"; |
|
46 | err = "GetModuleFileName failed"; | |
49 | goto bail; |
|
47 | goto bail; | |
50 | } |
|
48 | } | |
@@ -87,10 +85,12 b' int main(int argc, char *argv[])' | |||||
87 | strcat_s(pydllfile, sizeof(pydllfile), "\\" HGPYTHONLIB ".dll"); |
|
85 | strcat_s(pydllfile, sizeof(pydllfile), "\\" HGPYTHONLIB ".dll"); | |
88 | pydll = LoadLibrary(pydllfile); |
|
86 | pydll = LoadLibrary(pydllfile); | |
89 | if (pydll == NULL) { |
|
87 | if (pydll == NULL) { | |
90 |
err = "failed to load private Python DLL " HGPYTHONLIB |
|
88 | err = "failed to load private Python DLL " HGPYTHONLIB | |
|
89 | ".dll"; | |||
91 | goto bail; |
|
90 | goto bail; | |
92 | } |
|
91 | } | |
93 | Py_SetPythonHome = (void*)GetProcAddress(pydll, "Py_SetPythonHome"); |
|
92 | Py_SetPythonHome = | |
|
93 | (void *)GetProcAddress(pydll, "Py_SetPythonHome"); | |||
94 | if (Py_SetPythonHome == NULL) { |
|
94 | if (Py_SetPythonHome == NULL) { | |
95 | err = "failed to get Py_SetPythonHome"; |
|
95 | err = "failed to get Py_SetPythonHome"; | |
96 | goto bail; |
|
96 | goto bail; | |
@@ -106,7 +106,7 b' int main(int argc, char *argv[])' | |||||
106 | } |
|
106 | } | |
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | Py_Main = (void*)GetProcAddress(pydll, "Py_Main"); |
|
109 | Py_Main = (void *)GetProcAddress(pydll, "Py_Main"); | |
110 | if (Py_Main == NULL) { |
|
110 | if (Py_Main == NULL) { | |
111 | err = "failed to get Py_Main"; |
|
111 | err = "failed to get Py_Main"; | |
112 | goto bail; |
|
112 | goto bail; | |
@@ -133,7 +133,7 b' int main(int argc, char *argv[])' | |||||
133 | name of our exe (argv[0]) in the position where the python.exe |
|
133 | name of our exe (argv[0]) in the position where the python.exe | |
134 | canonically is, and insert the pyscript next. |
|
134 | canonically is, and insert the pyscript next. | |
135 | */ |
|
135 | */ | |
136 | pyargv = malloc((argc + 5) * sizeof(char*)); |
|
136 | pyargv = malloc((argc + 5) * sizeof(char *)); | |
137 | if (pyargv == NULL) { |
|
137 | if (pyargv == NULL) { | |
138 | err = "not enough memory"; |
|
138 | err = "not enough memory"; | |
139 | goto bail; |
|
139 | goto bail; |
General Comments 0
You need to be logged in to leave comments.
Login now