Skip to content

Commit bb579f1

Browse files
author
martin.v.loewis
committed
Issue #4494: Fix build with Py_NO_ENABLE_SHARED on Windows.
git-svn-id: http://svn.python.org/projects/python/trunk@69205 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 52c0713 commit bb579f1

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Misc/NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ Tools/Demos
397397
Build
398398
-----
399399

400+
- Issue #4494: Fix build with Py_NO_ENABLE_SHARED on Windows.
401+
400402
- Issue #4895: Use _strdup on Windows CE.
401403

402404
- Issue #4472: "configure --enable-shared" now works on OSX

PC/getpathp.c

+12
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ search_for_prefix(char *argv0_path, char *landmark)
201201
}
202202

203203
#ifdef MS_WINDOWS
204+
#ifdef Py_ENABLE_SHARED
204205

205206
/* a string loaded from the DLL at startup.*/
206207
extern const char *PyWin_DLLVersionString;
@@ -363,6 +364,7 @@ getpythonregpath(HKEY keyBase, int skipcore)
363364
free(keyBuf);
364365
return retval;
365366
}
367+
#endif /* Py_ENABLE_SHARED */
366368
#endif /* MS_WINDOWS */
367369

368370
static void
@@ -380,6 +382,7 @@ get_progpath(void)
380382
but makes no mention of the null terminator. Play it safe.
381383
PLUS Windows itself defines MAX_PATH as the same, but anyway...
382384
*/
385+
#ifdef Py_ENABLE_SHARED
383386
wprogpath[MAXPATHLEN]=_T('\0');
384387
if (PyWin_DLLhModule &&
385388
GetModuleFileName(PyWin_DLLhModule, wprogpath, MAXPATHLEN)) {
@@ -388,6 +391,9 @@ get_progpath(void)
388391
dllpath, MAXPATHLEN+1,
389392
NULL, NULL);
390393
}
394+
#else
395+
dllpath[0] = 0;
396+
#endif
391397
wprogpath[MAXPATHLEN]=_T('\0');
392398
if (GetModuleFileName(NULL, wprogpath, MAXPATHLEN)) {
393399
WideCharToMultiByte(CP_ACP, 0,
@@ -398,9 +404,13 @@ get_progpath(void)
398404
}
399405
#else
400406
/* static init of progpath ensures final char remains \0 */
407+
#ifdef Py_ENABLE_SHARED
401408
if (PyWin_DLLhModule)
402409
if (!GetModuleFileName(PyWin_DLLhModule, dllpath, MAXPATHLEN))
403410
dllpath[0] = 0;
411+
#else
412+
dllpath[0] = 0;
413+
#endif
404414
if (GetModuleFileName(NULL, progpath, MAXPATHLEN))
405415
return;
406416
#endif
@@ -501,8 +511,10 @@ calculate_path(void)
501511
}
502512

503513
skiphome = pythonhome==NULL ? 0 : 1;
514+
#ifdef Py_ENABLE_SHARED
504515
machinepath = getpythonregpath(HKEY_LOCAL_MACHINE, skiphome);
505516
userpath = getpythonregpath(HKEY_CURRENT_USER, skiphome);
517+
#endif
506518
/* We only use the default relative PYTHONPATH if we havent
507519
anything better to use! */
508520
skipdefault = envpath!=NULL || pythonhome!=NULL || \

0 commit comments

Comments
 (0)