Changes for dynamic linking under NT

This commit is contained in:
Guido van Rossum 1994-08-18 16:18:13 +00:00
parent 14aa5da824
commit e89bc75048
21 changed files with 72 additions and 59 deletions

View File

@ -46,7 +46,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define AC_R_PUBLIC 0004 #define AC_R_PUBLIC 0004
#define AC_W_PUBLIC 0002 #define AC_W_PUBLIC 0002
extern typeobject Accesstype; extern DL_IMPORT typeobject Accesstype;
#define is_accessobject(v) ((v)->ob_type == &Accesstype) #define is_accessobject(v) ((v)->ob_type == &Accesstype)
@ -58,7 +58,7 @@ void setaccessowner PROTO((object *, object *));
object *cloneaccessobject PROTO((object *)); object *cloneaccessobject PROTO((object *));
int hasaccessvalue PROTO((object *)); int hasaccessvalue PROTO((object *));
extern typeobject Anynumbertype, Anysequencetype, Anymappingtype; extern DL_IMPORT typeobject Anynumbertype, Anysequencetype, Anymappingtype;
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -30,6 +30,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* "allobjects.c" -- Source for precompiled header "allobjects.h" */ /* "allobjects.c" -- Source for precompiled header "allobjects.h" */
/* Some systems (well, NT anyway!) require special declarations for
data items imported from dynamic modules. Note that this defn is
only turned on for the modules built as DL modules, not for python
itself.
*/
#define DL_IMPORT /* Save lots of #else/#if's */
#ifdef USE_DL_IMPORT
#ifdef NT
#undef DL_IMPORT
#define DL_IMPORT __declspec(dllimport)
#endif /* NT */
#endif /* USE_DL_IMPORT */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif

View File

@ -57,7 +57,7 @@ typedef struct {
#endif #endif
} instanceobject; } instanceobject;
extern typeobject Classtype, Instancetype, Instancemethodtype; extern DL_IMPORT typeobject Classtype, Instancetype, Instancemethodtype;
#define is_classobject(op) ((op)->ob_type == &Classtype) #define is_classobject(op) ((op)->ob_type == &Classtype)
#define is_instanceobject(op) ((op)->ob_type == &Instancetype) #define is_instanceobject(op) ((op)->ob_type == &Instancetype)

View File

@ -47,7 +47,7 @@ typedef struct {
object *co_name; /* string */ object *co_name; /* string */
} codeobject; } codeobject;
extern typeobject Codetype; extern DL_IMPORT typeobject Codetype;
#define is_codeobject(op) ((op)->ob_type == &Codetype) #define is_codeobject(op) ((op)->ob_type == &Codetype)

View File

@ -39,25 +39,25 @@ void err_clear PROTO((void));
/* Predefined exceptions */ /* Predefined exceptions */
extern object *AccessError; extern DL_IMPORT object *AccessError;
extern object *AttributeError; extern DL_IMPORT object *AttributeError;
extern object *ConflictError; extern DL_IMPORT object *ConflictError;
extern object *EOFError; extern DL_IMPORT object *EOFError;
extern object *IOError; extern DL_IMPORT object *IOError;
extern object *ImportError; extern DL_IMPORT object *ImportError;
extern object *IndexError; extern DL_IMPORT object *IndexError;
extern object *KeyError; extern DL_IMPORT object *KeyError;
extern object *KeyboardInterrupt; extern DL_IMPORT object *KeyboardInterrupt;
extern object *MemoryError; extern DL_IMPORT object *MemoryError;
extern object *NameError; extern DL_IMPORT object *NameError;
extern object *OverflowError; extern DL_IMPORT object *OverflowError;
extern object *RuntimeError; extern DL_IMPORT object *RuntimeError;
extern object *SyntaxError; extern DL_IMPORT object *SyntaxError;
extern object *SystemError; extern DL_IMPORT object *SystemError;
extern object *SystemExit; extern DL_IMPORT object *SystemExit;
extern object *TypeError; extern DL_IMPORT object *TypeError;
extern object *ValueError; extern DL_IMPORT object *ValueError;
extern object *ZeroDivisionError; extern DL_IMPORT object *ZeroDivisionError;
/* Convenience functions */ /* Convenience functions */

View File

@ -30,7 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* File object interface */ /* File object interface */
extern typeobject Filetype; extern DL_IMPORT typeobject Filetype;
#define is_fileobject(op) ((op)->ob_type == &Filetype) #define is_fileobject(op) ((op)->ob_type == &Filetype)

View File

@ -39,7 +39,7 @@ typedef struct {
double ob_fval; double ob_fval;
} floatobject; } floatobject;
extern typeobject Floattype; extern DL_IMPORT typeobject Floattype;
#define is_floatobject(op) ((op)->ob_type == &Floattype) #define is_floatobject(op) ((op)->ob_type == &Floattype)

View File

@ -58,7 +58,7 @@ typedef struct _frame {
/* Standard object interface */ /* Standard object interface */
extern typeobject Frametype; extern DL_IMPORT typeobject Frametype;
#define is_frameobject(op) ((op)->ob_type == &Frametype) #define is_frameobject(op) ((op)->ob_type == &Frametype)

View File

@ -39,7 +39,7 @@ typedef struct {
object *func_argdefs; object *func_argdefs;
} funcobject; } funcobject;
extern typeobject Functype; extern DL_IMPORT typeobject Functype;
#define is_funcobject(op) ((op)->ob_type == &Functype) #define is_funcobject(op) ((op)->ob_type == &Functype)

View File

@ -50,7 +50,7 @@ typedef struct {
long ob_ival; long ob_ival;
} intobject; } intobject;
extern typeobject Inttype; extern DL_IMPORT typeobject Inttype;
#define is_intobject(op) ((op)->ob_type == &Inttype) #define is_intobject(op) ((op)->ob_type == &Inttype)
@ -69,7 +69,7 @@ Hope these macros don't conflict with other people's.
Don't forget to apply INCREF() when returning True or False!!! Don't forget to apply INCREF() when returning True or False!!!
*/ */
extern intobject FalseObject, TrueObject; /* Don't use these directly */ extern DL_IMPORT intobject FalseObject, TrueObject; /* Don't use these directly */
#define False ((object *) &FalseObject) #define False ((object *) &FalseObject)
#define True ((object *) &TrueObject) #define True ((object *) &TrueObject)

View File

@ -49,7 +49,7 @@ typedef struct {
object **ob_item; object **ob_item;
} listobject; } listobject;
extern typeobject Listtype; extern DL_IMPORT typeobject Listtype;
#define is_listobject(op) ((op)->ob_type == &Listtype) #define is_listobject(op) ((op)->ob_type == &Listtype)

View File

@ -32,7 +32,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
typedef struct _longobject longobject; /* Revealed in longintrepr.h */ typedef struct _longobject longobject; /* Revealed in longintrepr.h */
extern typeobject Longtype; extern DL_IMPORT typeobject Longtype;
#define is_longobject(op) ((op)->ob_type == &Longtype) #define is_longobject(op) ((op)->ob_type == &Longtype)

View File

@ -30,7 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Mapping object type -- mapping from hashable object to object */ /* Mapping object type -- mapping from hashable object to object */
extern typeobject Mappingtype; extern DL_IMPORT typeobject Mappingtype;
#define is_mappingobject(op) ((op)->ob_type == &Mappingtype) #define is_mappingobject(op) ((op)->ob_type == &Mappingtype)

View File

@ -30,7 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Method object interface */ /* Method object interface */
extern typeobject Methodtype; extern DL_IMPORT typeobject Methodtype;
#define is_methodobject(op) ((op)->ob_type == &Methodtype) #define is_methodobject(op) ((op)->ob_type == &Methodtype)

View File

@ -30,7 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Module object interface */ /* Module object interface */
extern typeobject Moduletype; extern DL_IMPORT typeobject Moduletype;
#define is_moduleobject(op) ((op)->ob_type == &Moduletype) #define is_moduleobject(op) ((op)->ob_type == &Moduletype)

View File

@ -227,7 +227,7 @@ typedef struct _typeobject {
#endif #endif
} typeobject; } typeobject;
extern typeobject Typetype; /* The type of type objects */ extern DL_IMPORT typeobject Typetype; /* The type of type objects */
#define is_typeobject(op) ((op)->ob_type == &Typetype) #define is_typeobject(op) ((op)->ob_type == &Typetype)
@ -341,7 +341,7 @@ where NULL (nil) is not suitable (since NULL often means 'error').
Don't forget to apply INCREF() when returning this value!!! Don't forget to apply INCREF() when returning this value!!!
*/ */
extern object NoObject; /* Don't use this directly */ extern DL_IMPORT object NoObject; /* Don't use this directly */
#define None (&NoObject) #define None (&NoObject)

View File

@ -39,25 +39,25 @@ void err_clear PROTO((void));
/* Predefined exceptions */ /* Predefined exceptions */
extern object *AccessError; extern DL_IMPORT object *AccessError;
extern object *AttributeError; extern DL_IMPORT object *AttributeError;
extern object *ConflictError; extern DL_IMPORT object *ConflictError;
extern object *EOFError; extern DL_IMPORT object *EOFError;
extern object *IOError; extern DL_IMPORT object *IOError;
extern object *ImportError; extern DL_IMPORT object *ImportError;
extern object *IndexError; extern DL_IMPORT object *IndexError;
extern object *KeyError; extern DL_IMPORT object *KeyError;
extern object *KeyboardInterrupt; extern DL_IMPORT object *KeyboardInterrupt;
extern object *MemoryError; extern DL_IMPORT object *MemoryError;
extern object *NameError; extern DL_IMPORT object *NameError;
extern object *OverflowError; extern DL_IMPORT object *OverflowError;
extern object *RuntimeError; extern DL_IMPORT object *RuntimeError;
extern object *SyntaxError; extern DL_IMPORT object *SyntaxError;
extern object *SystemError; extern DL_IMPORT object *SystemError;
extern object *SystemExit; extern DL_IMPORT object *SystemExit;
extern object *TypeError; extern DL_IMPORT object *TypeError;
extern object *ValueError; extern DL_IMPORT object *ValueError;
extern object *ZeroDivisionError; extern DL_IMPORT object *ZeroDivisionError;
/* Convenience functions */ /* Convenience functions */

View File

@ -34,7 +34,7 @@ Range objects behave like the corresponding tuple objects except that
they are represented by a start, stop, and step datamembers. they are represented by a start, stop, and step datamembers.
*/ */
extern typeobject Rangetype; extern DL_IMPORT typeobject Rangetype;
#define is_rangeobject(op) ((op)->ob_type == &Rangetype) #define is_rangeobject(op) ((op)->ob_type == &Rangetype)

View File

@ -57,7 +57,7 @@ typedef struct {
char ob_sval[1]; char ob_sval[1];
} stringobject; } stringobject;
extern typeobject Stringtype; extern DL_IMPORT typeobject Stringtype;
#define is_stringobject(op) ((op)->ob_type == &Stringtype) #define is_stringobject(op) ((op)->ob_type == &Stringtype)

View File

@ -35,7 +35,7 @@ int sysset PROTO((char *, object *));
FILE *sysgetfile PROTO((char *, FILE *)); FILE *sysgetfile PROTO((char *, FILE *));
void initsys PROTO((void)); void initsys PROTO((void));
extern object *sys_trace, *sys_profile; extern DL_IMPORT object *sys_trace, *sys_profile;
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -49,7 +49,7 @@ typedef struct {
object *ob_item[1]; object *ob_item[1];
} tupleobject; } tupleobject;
extern typeobject Tupletype; extern DL_IMPORT typeobject Tupletype;
#define is_tupleobject(op) ((op)->ob_type == &Tupletype) #define is_tupleobject(op) ((op)->ob_type == &Tupletype)