From e89bc75048d0142859379b2b92e77d984fdbef6e Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 18 Aug 1994 16:18:13 +0000 Subject: Changes for dynamic linking under NT --- Include/accessobject.h | 4 ++-- Include/allobjects.h | 13 +++++++++++++ Include/classobject.h | 2 +- Include/compile.h | 2 +- Include/errors.h | 38 +++++++++++++++++++------------------- Include/fileobject.h | 2 +- Include/floatobject.h | 2 +- Include/frameobject.h | 2 +- Include/funcobject.h | 2 +- Include/intobject.h | 4 ++-- Include/listobject.h | 2 +- Include/longobject.h | 2 +- Include/mappingobject.h | 2 +- Include/methodobject.h | 2 +- Include/moduleobject.h | 2 +- Include/object.h | 4 ++-- Include/pyerrors.h | 38 +++++++++++++++++++------------------- Include/rangeobject.h | 2 +- Include/stringobject.h | 2 +- Include/sysmodule.h | 2 +- Include/tupleobject.h | 2 +- 21 files changed, 72 insertions(+), 59 deletions(-) diff --git a/Include/accessobject.h b/Include/accessobject.h index fd8c2e9..5619308 100644 --- a/Include/accessobject.h +++ b/Include/accessobject.h @@ -46,7 +46,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define AC_R_PUBLIC 0004 #define AC_W_PUBLIC 0002 -extern typeobject Accesstype; +extern DL_IMPORT typeobject Accesstype; #define is_accessobject(v) ((v)->ob_type == &Accesstype) @@ -58,7 +58,7 @@ void setaccessowner PROTO((object *, object *)); object *cloneaccessobject PROTO((object *)); int hasaccessvalue PROTO((object *)); -extern typeobject Anynumbertype, Anysequencetype, Anymappingtype; +extern DL_IMPORT typeobject Anynumbertype, Anysequencetype, Anymappingtype; #ifdef __cplusplus } diff --git a/Include/allobjects.h b/Include/allobjects.h index 2b361c1..3d555d0 100644 --- a/Include/allobjects.h +++ b/Include/allobjects.h @@ -30,6 +30,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* "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 #include "config.h" #endif diff --git a/Include/classobject.h b/Include/classobject.h index 6b1b85b..f619345 100644 --- a/Include/classobject.h +++ b/Include/classobject.h @@ -57,7 +57,7 @@ typedef struct { #endif } instanceobject; -extern typeobject Classtype, Instancetype, Instancemethodtype; +extern DL_IMPORT typeobject Classtype, Instancetype, Instancemethodtype; #define is_classobject(op) ((op)->ob_type == &Classtype) #define is_instanceobject(op) ((op)->ob_type == &Instancetype) diff --git a/Include/compile.h b/Include/compile.h index 4526523..6c782da 100644 --- a/Include/compile.h +++ b/Include/compile.h @@ -47,7 +47,7 @@ typedef struct { object *co_name; /* string */ } codeobject; -extern typeobject Codetype; +extern DL_IMPORT typeobject Codetype; #define is_codeobject(op) ((op)->ob_type == &Codetype) diff --git a/Include/errors.h b/Include/errors.h index 050ff19..33c7806 100755 --- a/Include/errors.h +++ b/Include/errors.h @@ -39,25 +39,25 @@ void err_clear PROTO((void)); /* Predefined exceptions */ -extern object *AccessError; -extern object *AttributeError; -extern object *ConflictError; -extern object *EOFError; -extern object *IOError; -extern object *ImportError; -extern object *IndexError; -extern object *KeyError; -extern object *KeyboardInterrupt; -extern object *MemoryError; -extern object *NameError; -extern object *OverflowError; -extern object *RuntimeError; -extern object *SyntaxError; -extern object *SystemError; -extern object *SystemExit; -extern object *TypeError; -extern object *ValueError; -extern object *ZeroDivisionError; +extern DL_IMPORT object *AccessError; +extern DL_IMPORT object *AttributeError; +extern DL_IMPORT object *ConflictError; +extern DL_IMPORT object *EOFError; +extern DL_IMPORT object *IOError; +extern DL_IMPORT object *ImportError; +extern DL_IMPORT object *IndexError; +extern DL_IMPORT object *KeyError; +extern DL_IMPORT object *KeyboardInterrupt; +extern DL_IMPORT object *MemoryError; +extern DL_IMPORT object *NameError; +extern DL_IMPORT object *OverflowError; +extern DL_IMPORT object *RuntimeError; +extern DL_IMPORT object *SyntaxError; +extern DL_IMPORT object *SystemError; +extern DL_IMPORT object *SystemExit; +extern DL_IMPORT object *TypeError; +extern DL_IMPORT object *ValueError; +extern DL_IMPORT object *ZeroDivisionError; /* Convenience functions */ diff --git a/Include/fileobject.h b/Include/fileobject.h index c52a6aa..7cdd63a 100644 --- a/Include/fileobject.h +++ b/Include/fileobject.h @@ -30,7 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* File object interface */ -extern typeobject Filetype; +extern DL_IMPORT typeobject Filetype; #define is_fileobject(op) ((op)->ob_type == &Filetype) diff --git a/Include/floatobject.h b/Include/floatobject.h index 1d0484f..f6999bd 100644 --- a/Include/floatobject.h +++ b/Include/floatobject.h @@ -39,7 +39,7 @@ typedef struct { double ob_fval; } floatobject; -extern typeobject Floattype; +extern DL_IMPORT typeobject Floattype; #define is_floatobject(op) ((op)->ob_type == &Floattype) diff --git a/Include/frameobject.h b/Include/frameobject.h index 2458881..d9b375a 100644 --- a/Include/frameobject.h +++ b/Include/frameobject.h @@ -58,7 +58,7 @@ typedef struct _frame { /* Standard object interface */ -extern typeobject Frametype; +extern DL_IMPORT typeobject Frametype; #define is_frameobject(op) ((op)->ob_type == &Frametype) diff --git a/Include/funcobject.h b/Include/funcobject.h index 84b0dcf..cb36518 100644 --- a/Include/funcobject.h +++ b/Include/funcobject.h @@ -39,7 +39,7 @@ typedef struct { object *func_argdefs; } funcobject; -extern typeobject Functype; +extern DL_IMPORT typeobject Functype; #define is_funcobject(op) ((op)->ob_type == &Functype) diff --git a/Include/intobject.h b/Include/intobject.h index 2ede41e..28471b5 100644 --- a/Include/intobject.h +++ b/Include/intobject.h @@ -50,7 +50,7 @@ typedef struct { long ob_ival; } intobject; -extern typeobject Inttype; +extern DL_IMPORT typeobject 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!!! */ -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 True ((object *) &TrueObject) diff --git a/Include/listobject.h b/Include/listobject.h index 610096b..212e3ce 100644 --- a/Include/listobject.h +++ b/Include/listobject.h @@ -49,7 +49,7 @@ typedef struct { object **ob_item; } listobject; -extern typeobject Listtype; +extern DL_IMPORT typeobject Listtype; #define is_listobject(op) ((op)->ob_type == &Listtype) diff --git a/Include/longobject.h b/Include/longobject.h index ce2cd0b..4c21e7a 100644 --- a/Include/longobject.h +++ b/Include/longobject.h @@ -32,7 +32,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. typedef struct _longobject longobject; /* Revealed in longintrepr.h */ -extern typeobject Longtype; +extern DL_IMPORT typeobject Longtype; #define is_longobject(op) ((op)->ob_type == &Longtype) diff --git a/Include/mappingobject.h b/Include/mappingobject.h index 8844c77..caedbc7 100644 --- a/Include/mappingobject.h +++ b/Include/mappingobject.h @@ -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 */ -extern typeobject Mappingtype; +extern DL_IMPORT typeobject Mappingtype; #define is_mappingobject(op) ((op)->ob_type == &Mappingtype) diff --git a/Include/methodobject.h b/Include/methodobject.h index 1ef19aa..5799a18 100644 --- a/Include/methodobject.h +++ b/Include/methodobject.h @@ -30,7 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* Method object interface */ -extern typeobject Methodtype; +extern DL_IMPORT typeobject Methodtype; #define is_methodobject(op) ((op)->ob_type == &Methodtype) diff --git a/Include/moduleobject.h b/Include/moduleobject.h index 0605d31..3bd2642 100644 --- a/Include/moduleobject.h +++ b/Include/moduleobject.h @@ -30,7 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* Module object interface */ -extern typeobject Moduletype; +extern DL_IMPORT typeobject Moduletype; #define is_moduleobject(op) ((op)->ob_type == &Moduletype) diff --git a/Include/object.h b/Include/object.h index cf10ec5..e419567 100644 --- a/Include/object.h +++ b/Include/object.h @@ -227,7 +227,7 @@ typedef struct _typeobject { #endif } 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) @@ -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!!! */ -extern object NoObject; /* Don't use this directly */ +extern DL_IMPORT object NoObject; /* Don't use this directly */ #define None (&NoObject) diff --git a/Include/pyerrors.h b/Include/pyerrors.h index 050ff19..33c7806 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -39,25 +39,25 @@ void err_clear PROTO((void)); /* Predefined exceptions */ -extern object *AccessError; -extern object *AttributeError; -extern object *ConflictError; -extern object *EOFError; -extern object *IOError; -extern object *ImportError; -extern object *IndexError; -extern object *KeyError; -extern object *KeyboardInterrupt; -extern object *MemoryError; -extern object *NameError; -extern object *OverflowError; -extern object *RuntimeError; -extern object *SyntaxError; -extern object *SystemError; -extern object *SystemExit; -extern object *TypeError; -extern object *ValueError; -extern object *ZeroDivisionError; +extern DL_IMPORT object *AccessError; +extern DL_IMPORT object *AttributeError; +extern DL_IMPORT object *ConflictError; +extern DL_IMPORT object *EOFError; +extern DL_IMPORT object *IOError; +extern DL_IMPORT object *ImportError; +extern DL_IMPORT object *IndexError; +extern DL_IMPORT object *KeyError; +extern DL_IMPORT object *KeyboardInterrupt; +extern DL_IMPORT object *MemoryError; +extern DL_IMPORT object *NameError; +extern DL_IMPORT object *OverflowError; +extern DL_IMPORT object *RuntimeError; +extern DL_IMPORT object *SyntaxError; +extern DL_IMPORT object *SystemError; +extern DL_IMPORT object *SystemExit; +extern DL_IMPORT object *TypeError; +extern DL_IMPORT object *ValueError; +extern DL_IMPORT object *ZeroDivisionError; /* Convenience functions */ diff --git a/Include/rangeobject.h b/Include/rangeobject.h index 9befd9b..50d660b 100644 --- a/Include/rangeobject.h +++ b/Include/rangeobject.h @@ -34,7 +34,7 @@ Range objects behave like the corresponding tuple objects except that 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) diff --git a/Include/stringobject.h b/Include/stringobject.h index 6896a55..b6ec1c8 100644 --- a/Include/stringobject.h +++ b/Include/stringobject.h @@ -57,7 +57,7 @@ typedef struct { char ob_sval[1]; } stringobject; -extern typeobject Stringtype; +extern DL_IMPORT typeobject Stringtype; #define is_stringobject(op) ((op)->ob_type == &Stringtype) diff --git a/Include/sysmodule.h b/Include/sysmodule.h index 93e3a51..e48e4a3 100644 --- a/Include/sysmodule.h +++ b/Include/sysmodule.h @@ -35,7 +35,7 @@ int sysset PROTO((char *, object *)); FILE *sysgetfile PROTO((char *, FILE *)); void initsys PROTO((void)); -extern object *sys_trace, *sys_profile; +extern DL_IMPORT object *sys_trace, *sys_profile; #ifdef __cplusplus } diff --git a/Include/tupleobject.h b/Include/tupleobject.h index b422a40..f89c655 100644 --- a/Include/tupleobject.h +++ b/Include/tupleobject.h @@ -49,7 +49,7 @@ typedef struct { object *ob_item[1]; } tupleobject; -extern typeobject Tupletype; +extern DL_IMPORT typeobject Tupletype; #define is_tupleobject(op) ((op)->ob_type == &Tupletype) -- cgit v0.12