Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8235ea1c
Commit
8235ea1c
authored
Jul 19, 2002
by
Mark Hammond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Land Patch [ 566100 ] Rationalize DL_IMPORT and DL_EXPORT.
parent
b8816981
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
209 additions
and
256 deletions
+209
-256
Doc/ext/extending.tex
Doc/ext/extending.tex
+8
-5
Include/import.h
Include/import.h
+17
-17
Include/pyport.h
Include/pyport.h
+76
-22
Makefile.pre.in
Makefile.pre.in
+3
-3
Modules/_sre.c
Modules/_sre.c
+1
-2
Modules/pyexpat.c
Modules/pyexpat.c
+2
-3
PC/_winreg.c
PC/_winreg.c
+1
-1
PC/pyconfig.h
PC/pyconfig.h
+82
-175
Python/thread.c
Python/thread.c
+0
-5
configure
configure
+8
-4
configure.in
configure.in
+2
-3
pyconfig.h.in
pyconfig.h.in
+9
-16
No files found.
Doc/ext/extending.tex
View file @
8235ea1c
...
@@ -212,7 +212,7 @@ and initialize it in your module's initialization function
...
@@ -212,7 +212,7 @@ and initialize it in your module's initialization function
the error checking for now):
the error checking for now):
\begin{verbatim}
\begin{verbatim}
void
PyMODINIT
_
FUNC
initspam(void)
initspam(void)
{
{
PyObject *m;
PyObject *m;
...
@@ -240,6 +240,7 @@ discarded, causing \cdata{SpamError} to become a dangling pointer.
...
@@ -240,6 +240,7 @@ discarded, causing \cdata{SpamError} to become a dangling pointer.
Should it become a dangling pointer, C code which raises the exception
Should it become a dangling pointer, C code which raises the exception
could cause a core dump or other unintended side effects.
could cause a core dump or other unintended side effects.
We discuss the use of PyMODINIT
_
FUNC later in this sample.
\section
{
Back to the Example
\section
{
Back to the Example
\label
{
backToExample
}}
\label
{
backToExample
}}
...
@@ -339,14 +340,16 @@ module, and should be the only non-\keyword{static} item defined in
...
@@ -339,14 +340,16 @@ module, and should be the only non-\keyword{static} item defined in
the module file:
the module file:
\begin{verbatim}
\begin{verbatim}
void
PyMODINIT
_
FUNC
initspam(void)
initspam(void)
{
{
(void) Py
_
InitModule("spam", SpamMethods);
(void) Py
_
InitModule("spam", SpamMethods);
}
}
\end{verbatim}
\end{verbatim}
Note that for
\Cpp
, this method must be declared
\code
{
extern "C"
}
.
Note that PyMODINIT
_
FUNC declares the function as
\code
{
void
}
return type,
declares any special linkage declarations required by the platform, and for
\Cpp
declares the function as
\code
{
extern "C"
}
.
When the Python program imports module
\module
{
spam
}
for the first
When the Python program imports module
\module
{
spam
}
for the first
time,
\cfunction
{
initspam()
}
is called. (See below for comments about
time,
\cfunction
{
initspam()
}
is called. (See below for comments about
...
@@ -1263,7 +1266,7 @@ the module's initialization function must take care of initializing
...
@@ -1263,7 +1266,7 @@ the module's initialization function must take care of initializing
the C API pointer array:
the C API pointer array:
\begin{verbatim}
\begin{verbatim}
void
PyMODINIT
_
FUNC
initspam(void)
initspam(void)
{
{
PyObject *m;
PyObject *m;
...
@@ -1352,7 +1355,7 @@ rather macro) \cfunction{import_spam()} in its initialization
...
@@ -1352,7 +1355,7 @@ rather macro) \cfunction{import_spam()} in its initialization
function:
function:
\begin{verbatim}
\begin{verbatim}
void
PyMODINIT
_
FUNC
initclient(void)
initclient(void)
{
{
PyObject *m;
PyObject *m;
...
...
Include/import.h
View file @
8235ea1c
...
@@ -7,32 +7,32 @@
...
@@ -7,32 +7,32 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
DL_IMPORT
(
long
)
PyImport_GetMagicNumber
(
void
);
PyAPI_FUNC
(
long
)
PyImport_GetMagicNumber
(
void
);
DL_IMPORT
(
PyObject
*
)
PyImport_ExecCodeModule
(
char
*
name
,
PyObject
*
co
);
PyAPI_FUNC
(
PyObject
*
)
PyImport_ExecCodeModule
(
char
*
name
,
PyObject
*
co
);
DL_IMPORT
(
PyObject
*
)
PyImport_ExecCodeModuleEx
(
PyAPI_FUNC
(
PyObject
*
)
PyImport_ExecCodeModuleEx
(
char
*
name
,
PyObject
*
co
,
char
*
pathname
);
char
*
name
,
PyObject
*
co
,
char
*
pathname
);
DL_IMPORT
(
PyObject
*
)
PyImport_GetModuleDict
(
void
);
PyAPI_FUNC
(
PyObject
*
)
PyImport_GetModuleDict
(
void
);
DL_IMPORT
(
PyObject
*
)
PyImport_AddModule
(
char
*
name
);
PyAPI_FUNC
(
PyObject
*
)
PyImport_AddModule
(
char
*
name
);
DL_IMPORT
(
PyObject
*
)
PyImport_ImportModule
(
char
*
name
);
PyAPI_FUNC
(
PyObject
*
)
PyImport_ImportModule
(
char
*
name
);
DL_IMPORT
(
PyObject
*
)
PyImport_ImportModuleEx
(
PyAPI_FUNC
(
PyObject
*
)
PyImport_ImportModuleEx
(
char
*
name
,
PyObject
*
globals
,
PyObject
*
locals
,
PyObject
*
fromlist
);
char
*
name
,
PyObject
*
globals
,
PyObject
*
locals
,
PyObject
*
fromlist
);
DL_IMPORT
(
PyObject
*
)
PyImport_Import
(
PyObject
*
name
);
PyAPI_FUNC
(
PyObject
*
)
PyImport_Import
(
PyObject
*
name
);
DL_IMPORT
(
PyObject
*
)
PyImport_ReloadModule
(
PyObject
*
m
);
PyAPI_FUNC
(
PyObject
*
)
PyImport_ReloadModule
(
PyObject
*
m
);
DL_IMPORT
(
void
)
PyImport_Cleanup
(
void
);
PyAPI_FUNC
(
void
)
PyImport_Cleanup
(
void
);
DL_IMPORT
(
int
)
PyImport_ImportFrozenModule
(
char
*
);
PyAPI_FUNC
(
int
)
PyImport_ImportFrozenModule
(
char
*
);
extern
DL_IMPORT
(
PyObject
*
)
_PyImport_FindExtension
(
char
*
,
char
*
);
extern
PyAPI_FUNC
(
PyObject
*
)
_PyImport_FindExtension
(
char
*
,
char
*
);
extern
DL_IMPORT
(
PyObject
*
)
_PyImport_FixupExtension
(
char
*
,
char
*
);
extern
PyAPI_FUNC
(
PyObject
*
)
_PyImport_FixupExtension
(
char
*
,
char
*
);
struct
_inittab
{
struct
_inittab
{
char
*
name
;
char
*
name
;
void
(
*
initfunc
)(
void
);
void
(
*
initfunc
)(
void
);
};
};
extern
DL_IMPORT
(
struct
_inittab
*
)
PyImport_Inittab
;
extern
PyAPI_DATA
(
struct
_inittab
*
)
PyImport_Inittab
;
extern
DL_IMPORT
(
int
)
PyImport_AppendInittab
(
char
*
name
,
void
(
*
initfunc
)(
void
));
extern
PyAPI_FUNC
(
int
)
PyImport_AppendInittab
(
char
*
name
,
void
(
*
initfunc
)(
void
));
extern
DL_IMPORT
(
int
)
PyImport_ExtendInittab
(
struct
_inittab
*
newtab
);
extern
PyAPI_FUNC
(
int
)
PyImport_ExtendInittab
(
struct
_inittab
*
newtab
);
struct
_frozen
{
struct
_frozen
{
char
*
name
;
char
*
name
;
...
@@ -43,7 +43,7 @@ struct _frozen {
...
@@ -43,7 +43,7 @@ struct _frozen {
/* Embedding apps may change this pointer to point to their favorite
/* Embedding apps may change this pointer to point to their favorite
collection of frozen modules: */
collection of frozen modules: */
extern
DL_IMPORT
(
struct
_frozen
*
)
PyImport_FrozenModules
;
extern
PyAPI_DATA
(
struct
_frozen
*
)
PyImport_FrozenModules
;
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
Include/pyport.h
View file @
8235ea1c
...
@@ -379,19 +379,82 @@ extern int fsync(int fd);
...
@@ -379,19 +379,82 @@ extern int fsync(int fd);
extern
double
hypot
(
double
,
double
);
extern
double
hypot
(
double
,
double
);
#endif
#endif
#ifndef __CYGWIN__
/* Declarations for symbol visibility.
#ifndef DL_IMPORT
/* declarations for DLL import */
#define DL_IMPORT(RTYPE) RTYPE
PyAPI_FUNC(type): Declares a public Python API function and return type
#endif
PyAPI_DATA(type): Declares public Python data and its type
#else
/* __CYGWIN__ */
PyMODINIT_FUNC: A Python module init function. If these functions are
#ifdef USE_DL_IMPORT
inside the Python core, they are private to the core.
#define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
If in an extension module, it may be declared with
#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
external linkage depending on the platform.
#else
/* !USE_DL_IMPORT */
#define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
As a number of platforms support/require "__declspec(dllimport/dllexport)",
#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
we support a HAVE_DECLSPEC_DLL macro to save duplication.
#endif
/* USE_DL_IMPORT */
*/
#endif
/* __CYGWIN__ */
/*
All windows ports, except cygwin, are handled in PC/pyconfig.h
BeOS is only other autoconf platform requiring special linkage handling
and both these use __declspec()
*/
#if defined(__CYGWIN__) || defined(__BEOS__)
# define HAVE_DECLSPEC_DLL
#endif
#if defined(Py_ENABLE_SHARED)
/* only get special linkage if built as shared */
# if defined(HAVE_DECLSPEC_DLL)
# ifdef Py_BUILD_CORE
# define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
# define PyAPI_DATA(RTYPE) __declspec(dllexport) RTYPE
/* module init functions inside the core need no external linkage */
# define PyMODINIT_FUNC void
# else
/* Py_BUILD_CORE */
/* Building an extension module, or an embedded situation */
/* public Python functions and data are imported */
# define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE
# define PyAPI_DATA(RTYPE) __declspec(dllimport) RTYPE
/* module init functions outside the core must be exported */
# if defined(__cplusplus)
# define PyMODINIT_FUNC extern "C" __declspec(dllexport) void
# else
/* __cplusplus */
# define PyMODINIT_FUNC __declspec(dllexport) void
# endif
/* __cplusplus */
# endif
/* Py_BUILD_CORE */
# endif
/* HAVE_DECLSPEC */
#endif
/* Py_ENABLE_SHARED */
/* If no external linkage macros defined by now, create defaults */
#ifndef PyAPI_FUNC
# define PyAPI_FUNC(RTYPE) RTYPE
#endif
#ifndef PyAPI_DATA
# define PyAPI_DATA(RTYPE) RTYPE
#endif
#ifndef PyMODINIT_FUNC
# if defined(__cplusplus)
# define PyMODINIT_FUNC extern "C" void
# else
/* __cplusplus */
# define PyMODINIT_FUNC void
# endif
/* __cplusplus */
#endif
/* Deprecated DL_IMPORT and DL_EXPORT macros */
#if defined(Py_ENABLE_SHARED) && defined (HAVE_DECLSPEC_DLL)
# if defined(Py_BUILD_CORE)
# define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
# else
# define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
# endif
#endif
#ifndef DL_EXPORT
# define DL_EXPORT(RTYPE) RTYPE
#endif
#ifndef DL_IMPORT
# define DL_IMPORT(RTYPE) RTYPE
#endif
/* End of deprecated DL_* macros */
/* If the fd manipulation macros aren't defined,
/* If the fd manipulation macros aren't defined,
here is a set that should do the job */
here is a set that should do the job */
...
@@ -458,15 +521,6 @@ typedef struct fd_set {
...
@@ -458,15 +521,6 @@ typedef struct fd_set {
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
#endif
#endif
/*
* Rename some functions for the Borland compiler
*/
#ifdef __BORLANDC__
# include <io.h>
# define _chsize chsize
# define _setmode setmode
#endif
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
Makefile.pre.in
View file @
8235ea1c
...
@@ -65,7 +65,7 @@ LINKFORSHARED= @LINKFORSHARED@
...
@@ -65,7 +65,7 @@ LINKFORSHARED= @LINKFORSHARED@
# Extra C flags added for building the interpreter object files.
# Extra C flags added for building the interpreter object files.
CFLAGSFORSHARED
=
@CFLAGSFORSHARED@
CFLAGSFORSHARED
=
@CFLAGSFORSHARED@
# C flags used for building the interpreter object files
# C flags used for building the interpreter object files
PY_CFLAGS
=
$(CFLAGS)
$(CPPFLAGS)
$(CFLAGSFORSHARED)
PY_CFLAGS
=
$(CFLAGS)
$(CPPFLAGS)
$(CFLAGSFORSHARED)
-DPy_BUILD_CORE
# Machine-dependent subdirectories
# Machine-dependent subdirectories
...
@@ -420,10 +420,10 @@ Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
...
@@ -420,10 +420,10 @@ Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
Python/compile.o Python/symtable.o
:
$(GRAMMAR_H)
Python/compile.o Python/symtable.o
:
$(GRAMMAR_H)
Python/getplatform.o
:
$(srcdir)/Python/getplatform.c
Python/getplatform.o
:
$(srcdir)/Python/getplatform.c
$(CC)
-c
$(
CFLAGS)
$(CPPFLAGS)
$(CFLAGSFORSHARED
)
-DPLATFORM
=
'"
$(MACHDEP)
"'
-o
$@
$(srcdir)
/Python/getplatform.c
$(CC)
-c
$(
PY_CFLAGS
)
-DPLATFORM
=
'"
$(MACHDEP)
"'
-o
$@
$(srcdir)
/Python/getplatform.c
Python/importdl.o
:
$(srcdir)/Python/importdl.c
Python/importdl.o
:
$(srcdir)/Python/importdl.c
$(CC)
-c
$(
CFLAGS)
$(CPPFLAGS)
$(CFLAGSFORSHARED
)
-I
$(DLINCLDIR)
-o
$@
$(srcdir)
/Python/importdl.c
$(CC)
-c
$(
PY_CFLAGS
)
-I
$(DLINCLDIR)
-o
$@
$(srcdir)
/Python/importdl.c
Objects/unicodectype.o
:
$(srcdir)/Objects/unicodectype.c
\
Objects/unicodectype.o
:
$(srcdir)/Objects/unicodectype.c
\
$(srcdir)/Objects/unicodetype_db.h
$(srcdir)/Objects/unicodetype_db.h
...
...
Modules/_sre.c
View file @
8235ea1c
...
@@ -2979,8 +2979,7 @@ static PyMethodDef _functions[] = {
...
@@ -2979,8 +2979,7 @@ static PyMethodDef _functions[] = {
{
NULL
,
NULL
}
{
NULL
,
NULL
}
};
};
DL_EXPORT
(
void
)
PyMODINIT_FUNC
init_sre
(
void
)
init_sre
(
void
)
{
{
PyObject
*
m
;
PyObject
*
m
;
PyObject
*
d
;
PyObject
*
d
;
...
...
Modules/pyexpat.c
View file @
8235ea1c
...
@@ -1583,10 +1583,9 @@ get_version_string(void)
...
@@ -1583,10 +1583,9 @@ get_version_string(void)
#define MODULE_INITFUNC initpyexpat
#define MODULE_INITFUNC initpyexpat
#endif
#endif
void
MODULE_INITFUNC
(
void
);
/* avoid compiler warnings */
PyMODINIT_FUNC
MODULE_INITFUNC
(
void
);
/* avoid compiler warnings */
DL_EXPORT
(
void
)
PyMODINIT_FUNC
MODULE_INITFUNC
(
void
)
MODULE_INITFUNC
(
void
)
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
PyObject
*
errmod_name
=
PyString_FromString
(
MODULE_NAME
".errors"
);
PyObject
*
errmod_name
=
PyString_FromString
(
MODULE_NAME
".errors"
);
...
...
PC/_winreg.c
View file @
8235ea1c
...
@@ -1423,7 +1423,7 @@ inskey(PyObject * d, char * name, HKEY key)
...
@@ -1423,7 +1423,7 @@ inskey(PyObject * d, char * name, HKEY key)
#define ADD_KEY(val) inskey(d, #val, val)
#define ADD_KEY(val) inskey(d, #val, val)
__declspec
(
dllexport
)
void
init_winreg
(
void
)
PyMODINIT_FUNC
init_winreg
(
void
)
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
m
=
Py_InitModule3
(
"_winreg"
,
winreg_methods
,
module_doc
);
m
=
Py_InitModule3
(
"_winreg"
,
winreg_methods
,
module_doc
);
...
...
PC/pyconfig.h
View file @
8235ea1c
...
@@ -14,23 +14,17 @@ the following #defines
...
@@ -14,23 +14,17 @@ the following #defines
MS_WIN64 - Code specific to the MS Win64 API
MS_WIN64 - Code specific to the MS Win64 API
MS_WIN32 - Code specific to the MS Win32 (and Win64) API (obsolete, this covers all supported APIs)
MS_WIN32 - Code specific to the MS Win32 (and Win64) API (obsolete, this covers all supported APIs)
MS_WINDOWS - Code specific to Windows, but all versions.
MS_WINDOWS - Code specific to Windows, but all versions.
MS_COREDLL - Code if the Python core is built as a DLL.
Py_ENABLE_SHARED - Code if the Python core is built as a DLL.
Note that the old defines "NT" and "WIN32" are still supported, but
will soon be dropped.
Also note that neither "_M_IX86" or "_MSC_VER" should be used for
Also note that neither "_M_IX86" or "_MSC_VER" should be used for
any purpose other than "Windows Intel x86 specific" and "Microsoft
any purpose other than "Windows Intel x86 specific" and "Microsoft
compiler specific". Therefore, these should be very rare.
compiler specific". Therefore, these should be very rare.
*/
NOTE: The following symbols are deprecated:
NT, WIN32, USE_DL_EXPORT, USE_DL_IMPORT, DL_EXPORT, DL_IMPORT
MS_CORE_DLL.
/*
Some systems require special declarations for data items imported
or exported from dynamic link libraries. Note that the definition
of DL_IMPORT covers both cases. Define USE_DL_IMPORT for the client
of a DLL. Define USE_DL_EXPORT when making a DLL.
*/
*/
#include <io.h>
#include <io.h>
...
@@ -40,12 +34,30 @@ compiler specific". Therefore, these should be very rare.
...
@@ -40,12 +34,30 @@ compiler specific". Therefore, these should be very rare.
#define HAVE_TEMPNAM
#define HAVE_TEMPNAM
#define HAVE_TMPFILE
#define HAVE_TMPFILE
#define HAVE_TMPNAM
#define HAVE_TMPNAM
#define HAVE_CLOCK
#define HAVE_STRFTIME
#define HAVE_STRERROR
#define DONT_HAVE_SIG_ALARM
#define DONT_HAVE_SIG_ALARM
#define DONT_HAVE_SIG_PAUSE
#define DONT_HAVE_SIG_PAUSE
#define LONG_BIT 32
#define LONG_BIT 32
#define WORD_BIT 32
#define PREFIX ""
#define PREFIX ""
#define EXEC_PREFIX ""
#define EXEC_PREFIX ""
#define MS_WIN32
/* only support win32 and greater. */
#define MS_WINDOWS
#ifndef PYTHONPATH
# define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk"
#endif
#define NT_THREADS
#define WITH_THREAD
#ifndef NETSCAPE_PI
#define USE_SOCKET
#endif
/* Compiler specific defines */
/* ------------------------------------------------------------------------*/
/* Microsoft C defines _MSC_VER */
/* Microsoft C defines _MSC_VER */
#ifdef _MSC_VER
#ifdef _MSC_VER
...
@@ -60,11 +72,6 @@ compiler specific". Therefore, these should be very rare.
...
@@ -60,11 +72,6 @@ compiler specific". Therefore, these should be very rare.
#ifdef _WIN64
#ifdef _WIN64
#define MS_WIN64
#define MS_WIN64
#endif
#endif
#ifdef _WIN32
#define NT
/* NT is obsolete - please use MS_WIN32 instead */
#define MS_WIN32
#endif
#define MS_WINDOWS
/* set the COMPILER */
/* set the COMPILER */
#ifdef MS_WIN64
#ifdef MS_WIN64
...
@@ -87,99 +94,39 @@ compiler specific". Therefore, these should be very rare.
...
@@ -87,99 +94,39 @@ compiler specific". Therefore, these should be very rare.
#endif
#endif
#endif
/* MS_WIN32 && !MS_WIN64 */
#endif
/* MS_WIN32 && !MS_WIN64 */
#endif
/* _MSC_VER */
#if defined(_MSC_VER) && _MSC_VER > 850
/* Start of defines for MS_WIN32 using VC++ 2.0 and up */
/* For NT the Python core is in a DLL by default. Test the
standard macro MS_COREDLL to find out. If you have an exception
you must define MS_NO_COREDLL (do not test this macro) */
#ifndef MS_NO_COREDLL
#define MS_COREDLL
/* Python core is in a DLL */
#ifndef USE_DL_EXPORT
#define USE_DL_IMPORT
#endif
/* !USE_DL_EXPORT */
#endif
/* !MS_NO_COREDLL */
#define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk"
typedef
int
pid_t
;
typedef
int
pid_t
;
#define WORD_BIT 32
#pragma warning(disable:4113)
#define hypot _hypot
#define hypot _hypot
#include <stdio.h>
#define HAVE_CLOCK
#define HAVE_STRFTIME
#define HAVE_STRERROR
#define NT_THREADS
#define WITH_THREAD
#ifndef NETSCAPE_PI
#define USE_SOCKET
#endif
#ifdef USE_DL_IMPORT
#define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
#endif
#ifdef USE_DL_EXPORT
#define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
#endif
#define HAVE_LONG_LONG 1
#endif
/* _MSC_VER */
#define LONG_LONG __int64
#endif
/* _MSC_VER && > 850 */
/* define some ANSI types that are not defined in earlier Win headers */
#if defined(_MSC_VER) && _MSC_VER >= 1200
/* This file only exists in VC 6.0 or higher */
#include <basetsd.h>
#endif
/* ------------------------------------------------------------------------*/
/* The Borland compiler defines __BORLANDC__ */
/* The Borland compiler defines __BORLANDC__ */
/* XXX These defines are likely incomplete, but should be easy to fix. */
/* XXX These defines are likely incomplete, but should be easy to fix. */
#ifdef __BORLANDC__
#ifdef __BORLANDC__
#define COMPILER "[Borland]"
#define COMPILER "[Borland]"
#define HAVE_CLOCK
#define HAVE_STRFTIME
#ifdef _WIN32
#ifdef _WIN32
/* tested with BCC 5.5 (__BORLANDC__ >= 0x0550)
/* tested with BCC 5.5 (__BORLANDC__ >= 0x0550)
*/
*/
#define NT
/* NT is obsolete - please use MS_WIN32 instead */
#define MS_WIN32
#define MS_WINDOWS
/* For NT the Python core is in a DLL by default. Test the
standard macro MS_COREDLL to find out. If you have an exception
you must define MS_NO_COREDLL (do not test this macro) */
#ifndef MS_NO_COREDLL
#define MS_COREDLL
/* Python core is in a DLL */
#ifndef USE_DL_EXPORT
#define USE_DL_IMPORT
#endif
/* !USE_DL_EXPORT */
#endif
/* !MS_NO_COREDLL */
#define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk"
typedef
int
pid_t
;
typedef
int
pid_t
;
#define WORD_BIT 32
#include <stdio.h>
#define HAVE_STRERROR
#define NT_THREADS
#define WITH_THREAD
#ifndef NETSCAPE_PI
#define USE_SOCKET
#endif
/* BCC55 seems to understand __declspec(dllimport), it is used in its
/* BCC55 seems to understand __declspec(dllimport), it is used in its
own header files (winnt.h, ...) */
own header files (winnt.h, ...) - so we can do nothing and get the default*/
#ifdef USE_DL_IMPORT
#define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
#endif
#ifdef USE_DL_EXPORT
#define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
#endif
#define HAVE_LONG_LONG 1
#define LONG_LONG __int64
#undef HAVE_SYS_UTIME_H
#undef HAVE_SYS_UTIME_H
#define HAVE_UTIME_H
#define HAVE_UTIME_H
#define HAVE_DIRENT_H
#define HAVE_DIRENT_H
#define HAVE_CLOCK
/* rename a few functions for the Borland compiler */
#include <io.h>
#define _chsize chsize
#define _setmode setmode
#else
/* !_WIN32 */
#else
/* !_WIN32 */
#error "Only Win32 and later are supported"
#error "Only Win32 and later are supported"
...
@@ -187,6 +134,7 @@ typedef int pid_t;
...
@@ -187,6 +134,7 @@ typedef int pid_t;
#endif
/* BORLANDC */
#endif
/* BORLANDC */
/* ------------------------------------------------------------------------*/
/* egcs/gnu-win32 defines __GNUC__ and _WIN32 */
/* egcs/gnu-win32 defines __GNUC__ and _WIN32 */
#if defined(__GNUC__) && defined(_WIN32)
#if defined(__GNUC__) && defined(_WIN32)
/* XXX These defines are likely incomplete, but should be easy to fix.
/* XXX These defines are likely incomplete, but should be easy to fix.
...
@@ -199,97 +147,67 @@ typedef int pid_t;
...
@@ -199,97 +147,67 @@ typedef int pid_t;
#warning "Please use an up-to-date version of gcc! (>2.91 recommended)"
#warning "Please use an up-to-date version of gcc! (>2.91 recommended)"
#endif
#endif
#define NT
/* NT is obsolete - please use MS_WIN32 instead */
#define MS_WIN32
#define MS_WINDOWS
/* For NT the Python core is in a DLL by default. Test the
standard macro MS_COREDLL to find out. If you have an exception
you must define MS_NO_COREDLL (do not test this macro) */
#ifndef MS_NO_COREDLL
#define MS_COREDLL
/* Python core is in a DLL */
#ifndef USE_DL_EXPORT
#define USE_DL_IMPORT
#endif
/* !USE_DL_EXPORT */
#endif
/* !MS_NO_COREDLL */
#define COMPILER "[gcc]"
#define COMPILER "[gcc]"
#define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk"
#define WORD_BIT 32
#define hypot _hypot
#define hypot _hypot
#include <stdio.h>
#define HAVE_CLOCK
#define HAVE_STRFTIME
#define HAVE_STRERROR
#define NT_THREADS
#define WITH_THREAD
#ifndef NETSCAPE_PI
#define USE_SOCKET
#endif
#ifdef USE_DL_IMPORT
#define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
#endif
#ifdef USE_DL_EXPORT
#define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
#endif
#define HAVE_LONG_LONG 1
#define LONG_LONG long long
#define LONG_LONG long long
#endif
/* GNUC */
#endif
/* GNUC */
/* ------------------------------------------------------------------------*/
/* lcc-win32 defines __LCC__ */
/* lcc-win32 defines __LCC__ */
#if defined(__LCC__)
#if defined(__LCC__)
/* XXX These defines are likely incomplete, but should be easy to fix.
/* XXX These defines are likely incomplete, but should be easy to fix.
They should be complete enough to build extension modules. */
They should be complete enough to build extension modules. */
#define NT
/* NT is obsolete - please use MS_WIN32 instead */
#define MS_WIN32
#define MS_WINDOWS
/* For NT the Python core is in a DLL by default. Test the
standard macro MS_COREDLL to find out. If you have an exception
you must define MS_NO_COREDLL (do not test this macro) */
#ifndef MS_NO_COREDLL
#define MS_COREDLL
/* Python core is in a DLL */
#ifndef USE_DL_EXPORT
#define USE_DL_IMPORT
#endif
/* !USE_DL_EXPORT */
#endif
/* !MS_NO_COREDLL */
#define COMPILER "[lcc-win32]"
#define COMPILER "[lcc-win32]"
#define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk"
typedef
int
pid_t
;
typedef
int
pid_t
;
#define WORD_BIT 32
/* __declspec() is supported here too - do nothing to get the defaults */
#include <stdio.h>
#define HAVE_CLOCK
#define HAVE_STRFTIME
#define HAVE_STRERROR
#define NT_THREADS
#define WITH_THREAD
#ifndef NETSCAPE_PI
#define USE_SOCKET
#endif
#ifdef USE_DL_IMPORT
#define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
#endif
#ifdef USE_DL_EXPORT
#define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
#endif
#define HAVE_LONG_LONG 1
#define LONG_LONG __int64
#endif
/* LCC */
#endif
/* LCC */
/* ------------------------------------------------------------------------*/
/* End of compilers - finish up */
/* End of compilers - finish up */
/* define some ANSI types that are not defined in earlier Win headers */
#ifndef NO_STDIO_H
#if _MSC_VER >= 1200
/* This file only exists in VC 6.0 or higher */
# include <stdio.h>
#include <basetsd.h>
#endif
/* 64 bit ints are usually spelt __int64 unless compiler has overridden */
#define HAVE_LONG_LONG 1
#ifndef LONG_LONG
# define LONG_LONG __int64
#endif
#endif
/* For Windows the Python core is in a DLL by default. Test
Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
#if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED)
# define Py_ENABLE_SHARED 1
/* standard symbol for shared library */
# define MS_COREDLL
/* deprecated old symbol */
#endif
/* !MS_NO_COREDLL && ... */
/* Deprecated USE_DL_EXPORT macro - please use Py_BUILD_CORE */
#ifdef USE_DL_EXPORT
# define Py_BUILD_CORE
#endif
/* USE_DL_EXPORT */
/* All windows compilers that use this header support __declspec */
#define HAVE_DECLSPEC_DLL
/* For an MSVC DLL, we can nominate the .lib files used by extensions */
#ifdef MS_COREDLL
# ifndef Py_BUILD_CORE
/* not building the core - must be an ext */
# if defined(_MSC_VER)
/* So MSVC users need not specify the .lib file in
their Makefile (other compilers are generally
taken care of by distutils.) */
# ifdef _DEBUG
# pragma comment(lib,"python23_d.lib")
# else
# pragma comment(lib,"python23.lib")
# endif
/* _DEBUG */
# endif
/* _MSC_VER */
# endif
/* Py_BUILD_CORE */
#endif
/* MS_COREDLL */
#if defined(MS_WIN64)
#if defined(MS_WIN64)
/* maintain "win32" sys.platform for backward compatibility of Python code,
/* maintain "win32" sys.platform for backward compatibility of Python code,
the Win64 API should be close enough to the Win32 API to make this
the Win64 API should be close enough to the Win32 API to make this
...
@@ -321,23 +239,12 @@ typedef int pid_t;
...
@@ -321,23 +239,12 @@ typedef int pid_t;
# endif
# endif
#endif
#endif
#ifdef MS_WIN32
#if !defined(USE_DL_EXPORT) && defined(_MSC_VER)
/* So nobody using MSVC needs to specify the .lib in their Makefile any
more (other compilers will still need to do so, but that's taken care
of by the Distutils, so it's not a problem). */
#ifdef _DEBUG
#ifdef _DEBUG
#pragma comment(lib,"python23_d.lib")
# define Py_DEBUG
#else
#pragma comment(lib,"python23.lib")
#endif
#endif
#endif
/* USE_DL_EXPORT */
#ifdef _DEBUG
#define Py_DEBUG
#ifdef MS_WIN32
#endif
#define SIZEOF_SHORT 2
#define SIZEOF_SHORT 2
#define SIZEOF_INT 4
#define SIZEOF_INT 4
...
...
Python/thread.c
View file @
8235ea1c
...
@@ -7,11 +7,6 @@
...
@@ -7,11 +7,6 @@
#include "Python.h"
#include "Python.h"
/* pyconfig.h may or may not define DL_IMPORT */
#ifndef DL_IMPORT
/* declarations for DLL import/export */
#define DL_IMPORT(RTYPE) RTYPE
#endif
#ifndef DONT_HAVE_STDIO_H
#ifndef DONT_HAVE_STDIO_H
#include <stdio.h>
#include <stdio.h>
#endif
#endif
...
...
configure
View file @
8235ea1c
#! /bin/sh
#! /bin/sh
# From configure.in Revision: 1.33
0
.
# From configure.in Revision: 1.33
2
.
# Guess values for system-dependent variables and create Makefiles.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53.
# Generated by GNU Autoconf 2.53.
#
#
...
@@ -1225,6 +1225,7 @@ VERSION=2.3
...
@@ -1225,6 +1225,7 @@ VERSION=2.3
SOVERSION
=
1.0
SOVERSION
=
1.0
cat
>>
confdefs.h
<<
\
_ACEOF
cat
>>
confdefs.h
<<
\
_ACEOF
#define _XOPEN_SOURCE 500
#define _XOPEN_SOURCE 500
_ACEOF
_ACEOF
...
@@ -1347,8 +1348,7 @@ else
...
@@ -1347,8 +1348,7 @@ else
ppc
)
ppc
)
CC
=
mwcc
CC
=
mwcc
without_gcc
=
yes
without_gcc
=
yes
OPT
=
"-O -D'DL_EXPORT(RTYPE)=__declspec(dllexport) RTYPE' -D'DL_IMPORT(RTYPE)=__declspec(dllexport) RTYPE' -export pragma"
OPT
=
"-O -export pragma"
CCSHARED
=
"-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
LDFLAGS
=
"
$LDFLAGS
-nodup"
LDFLAGS
=
"
$LDFLAGS
-nodup"
;;
;;
x86
)
x86
)
...
@@ -3107,6 +3107,11 @@ fi
...
@@ -3107,6 +3107,11 @@ fi
# Other platforms follow
# Other platforms follow
if
test
$enable_shared
=
"yes"
;
then
if
test
$enable_shared
=
"yes"
;
then
cat
>>
confdefs.h
<<
\
_ACEOF
#define Py_ENABLE_SHARED 1
_ACEOF
case
$ac_sys_system
in
case
$ac_sys_system
in
BeOS
*
)
BeOS
*
)
LDLIBRARY
=
'libpython$(VERSION).so'
LDLIBRARY
=
'libpython$(VERSION).so'
...
@@ -8820,7 +8825,6 @@ then
...
@@ -8820,7 +8825,6 @@ then
*
gcc
*
)
CCSHARED
=
"-shared"
;;
*
gcc
*
)
CCSHARED
=
"-shared"
;;
*
)
CCSHARED
=
""
;;
*
)
CCSHARED
=
""
;;
esac
;;
esac
;;
CYGWIN
*
)
CCSHARED
=
"-DUSE_DL_IMPORT"
;;
atheos
*
)
CCSHARED
=
"-fPIC"
;;
atheos
*
)
CCSHARED
=
"-fPIC"
;;
esac
esac
fi
fi
...
...
configure.in
View file @
8235ea1c
...
@@ -125,8 +125,7 @@ AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
...
@@ -125,8 +125,7 @@ AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
ppc)
ppc)
CC=mwcc
CC=mwcc
without_gcc=yes
without_gcc=yes
OPT="-O -D'DL_EXPORT(RTYPE)=__declspec(dllexport) RTYPE' -D'DL_IMPORT(RTYPE)=__declspec(dllexport) RTYPE' -export pragma"
OPT="-O -export pragma"
CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
LDFLAGS="$LDFLAGS -nodup"
LDFLAGS="$LDFLAGS -nodup"
;;
;;
x86)
x86)
...
@@ -359,6 +358,7 @@ fi
...
@@ -359,6 +358,7 @@ fi
# Other platforms follow
# Other platforms follow
if test $enable_shared = "yes"; then
if test $enable_shared = "yes"; then
AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
case $ac_sys_system in
case $ac_sys_system in
BeOS*)
BeOS*)
LDLIBRARY='libpython$(VERSION).so'
LDLIBRARY='libpython$(VERSION).so'
...
@@ -948,7 +948,6 @@ then
...
@@ -948,7 +948,6 @@ then
*gcc*) CCSHARED="-shared";;
*gcc*) CCSHARED="-shared";;
*) CCSHARED="";;
*) CCSHARED="";;
esac;;
esac;;
CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
atheos*) CCSHARED="-fPIC";;
atheos*) CCSHARED="-fPIC";;
esac
esac
fi
fi
...
...
pyconfig.h.in
View file @
8235ea1c
...
@@ -11,10 +11,6 @@
...
@@ -11,10 +11,6 @@
on SGI IRIX 4.x) */
on SGI IRIX 4.x) */
#undef BAD_EXEC_PROTOTYPES
#undef BAD_EXEC_PROTOTYPES
/* Define if your compiler botches static forward declarations (as it does on
SCI ODT 3.0) */
#undef BAD_STATIC_FORWARD
/* Define this if you have BeOS threads. */
/* Define this if you have BeOS threads. */
#undef BEOS_THREADS
#undef BEOS_THREADS
...
@@ -128,9 +124,6 @@
...
@@ -128,9 +124,6 @@
/* Define to 1 if you have the `gai_strerror' function. */
/* Define to 1 if you have the `gai_strerror' function. */
#undef HAVE_GAI_STRERROR
#undef HAVE_GAI_STRERROR
/* Define to 1 if you have the <gdbm/ndbm.h> header file. */
#undef HAVE_GDBM_NDBM_H
/* Define if you have the getaddrinfo function. */
/* Define if you have the getaddrinfo function. */
#undef HAVE_GETADDRINFO
#undef HAVE_GETADDRINFO
...
@@ -272,9 +265,6 @@
...
@@ -272,9 +265,6 @@
/* Define to 1 if you have the <ncurses.h> header file. */
/* Define to 1 if you have the <ncurses.h> header file. */
#undef HAVE_NCURSES_H
#undef HAVE_NCURSES_H
/* Define to 1 if you have the <ndbm.h> header file. */
#undef HAVE_NDBM_H
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
#undef HAVE_NDIR_H
...
@@ -353,9 +343,6 @@
...
@@ -353,9 +343,6 @@
/* Define to 1 if you have the `setpgid' function. */
/* Define to 1 if you have the `setpgid' function. */
#undef HAVE_SETPGID
#undef HAVE_SETPGID
/* Define to 1 if you have the `setpgrp' function. */
#undef HAVE_SETPGRP
/* Define to 1 if you have the `setregid' function. */
/* Define to 1 if you have the `setregid' function. */
#undef HAVE_SETREGID
#undef HAVE_SETREGID
...
@@ -626,6 +613,9 @@
...
@@ -626,6 +613,9 @@
/* Define if you want to build an interpreter with many run-time checks. */
/* Define if you want to build an interpreter with many run-time checks. */
#undef Py_DEBUG
#undef Py_DEBUG
/* Defined if Python is built as a shared library. */
#undef Py_ENABLE_SHARED
/* Define as the size of the unicode type. */
/* Define as the size of the unicode type. */
#undef Py_UNICODE_SIZE
#undef Py_UNICODE_SIZE
...
@@ -638,6 +628,9 @@
...
@@ -638,6 +628,9 @@
/* Define if setpgrp() must be called as setpgrp(0, 0). */
/* Define if setpgrp() must be called as setpgrp(0, 0). */
#undef SETPGRP_HAVE_ARG
#undef SETPGRP_HAVE_ARG
/* Define to 1 if the `setpgrp' function takes no argument. */
#undef SETPGRP_VOID
/* Define if i>>j for signed int i does not extend the sign bit when i < 0 */
/* Define if i>>j for signed int i does not extend the sign bit when i < 0 */
#undef SIGNED_RIGHT_SHIFT_ZERO_FILLS
#undef SIGNED_RIGHT_SHIFT_ZERO_FILLS
...
@@ -712,9 +705,6 @@
...
@@ -712,9 +705,6 @@
/* Define if WINDOW in curses.h offers a field _flags. */
/* Define if WINDOW in curses.h offers a field _flags. */
#undef WINDOW_HAS_FLAGS
#undef WINDOW_HAS_FLAGS
/* Define if you want to compile in cycle garbage collection. */
#undef WITH_CYCLE_GC
/* Define if you want to emulate SGI (IRIX 4) dynamic linking. This is
/* Define if you want to emulate SGI (IRIX 4) dynamic linking. This is
rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4), Sequent Symmetry
rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4), Sequent Symmetry
(Dynix), and Atari ST. This requires the 'dl-dld' library,
(Dynix), and Atari ST. This requires the 'dl-dld' library,
...
@@ -783,6 +773,9 @@
...
@@ -783,6 +773,9 @@
/* Define to force use of thread-safe errno, h_errno, and other functions */
/* Define to force use of thread-safe errno, h_errno, and other functions */
#undef _REENTRANT
#undef _REENTRANT
/* Needed on Tru64 and does no harm on Linux */
#undef _XOPEN_SOURCE
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
#ifndef __CHAR_UNSIGNED__
# undef __CHAR_UNSIGNED__
# undef __CHAR_UNSIGNED__
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment