Add DL_IMPORT(returntype) for all officially exported functions.
diff --git a/Include/Python.h b/Include/Python.h
index e97fd6c..9b72d0f 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -41,6 +41,9 @@
 #ifndef DL_IMPORT	/* declarations for DLL import/export */
 #define DL_IMPORT(RTYPE) RTYPE
 #endif
+#ifndef DL_EXPORT	/* declarations for DLL import/export */
+#define DL_EXPORT(RTYPE) RTYPE
+#endif
 
 #ifdef SYMANTEC__CFM68K__
 #define UsingSharedLibs
diff --git a/Include/abstract.h b/Include/abstract.h
index 333b15e..a4b1bc3 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -254,7 +254,7 @@
        */
 #define  PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL)
 
-     int PyObject_Cmp Py_PROTO((PyObject *o1, PyObject *o2, int *result));
+     DL_IMPORT(int) PyObject_Cmp Py_PROTO((PyObject *o1, PyObject *o2, int *result));
 
        /*
 	 Compare the values of o1 and o2 using a routine provided by
@@ -302,7 +302,7 @@
 
        */
 
-     int PyCallable_Check Py_PROTO((PyObject *o));
+     DL_IMPORT(int) PyCallable_Check Py_PROTO((PyObject *o));
 
        /*
 	 Determine if the object, o, is callable.  Return 1 if the
@@ -314,7 +314,7 @@
 
 
      
-     PyObject *PyObject_CallObject Py_PROTO((PyObject *callable_object,
+     DL_IMPORT(PyObject *) PyObject_CallObject Py_PROTO((PyObject *callable_object,
 					     PyObject *args));
 
        /*
@@ -327,7 +327,7 @@
 
        */
 
-     PyObject *PyObject_CallFunction Py_PROTO((PyObject *callable_object,
+     DL_IMPORT(PyObject *) PyObject_CallFunction Py_PROTO((PyObject *callable_object,
 					       char *format, ...));
 
        /*
@@ -341,7 +341,7 @@
        */
 
 
-     PyObject *PyObject_CallMethod Py_PROTO((PyObject *o, char *m,
+     DL_IMPORT(PyObject *) PyObject_CallMethod Py_PROTO((PyObject *o, char *m,
 					     char *format, ...));
 
        /*
@@ -394,7 +394,7 @@
 	 
        */
 
-     PyObject *PyObject_Type Py_PROTO((PyObject *o));
+     DL_IMPORT(PyObject *) PyObject_Type Py_PROTO((PyObject *o));
 
        /*
 	 On success, returns a type object corresponding to the object
@@ -402,7 +402,7 @@
 	 equivalent to the Python expression: type(o).
        */
 
-     int PyObject_Length Py_PROTO((PyObject *o));
+     DL_IMPORT(int) PyObject_Length Py_PROTO((PyObject *o));
 
        /*
          Return the length of object o.  If the object, o, provides
@@ -412,7 +412,7 @@
 
        */
 
-     PyObject *PyObject_GetItem Py_PROTO((PyObject *o, PyObject *key));
+     DL_IMPORT(PyObject *) PyObject_GetItem Py_PROTO((PyObject *o, PyObject *key));
 
        /*
 	 Return element of o corresponding to the object, key, or NULL
@@ -421,7 +421,7 @@
 
        */
 
-     int PyObject_SetItem Py_PROTO((PyObject *o, PyObject *key, PyObject *v));
+     DL_IMPORT(int) PyObject_SetItem Py_PROTO((PyObject *o, PyObject *key, PyObject *v));
 
        /*
 	 Map the object, key, to the value, v.  Returns
@@ -429,7 +429,7 @@
 	 statement: o[key]=v.
        */
 
-     int PyObject_DelItem Py_PROTO((PyObject *o, PyObject *key));
+     DL_IMPORT(int) PyObject_DelItem Py_PROTO((PyObject *o, PyObject *key));
 
        /*
 	 Delete the mapping for key from *o.  Returns -1 on failure.
@@ -439,7 +439,7 @@
 
 /*  Number Protocol:*/
 
-     int PyNumber_Check Py_PROTO((PyObject *o));
+     DL_IMPORT(int) PyNumber_Check Py_PROTO((PyObject *o));
 
        /*
          Returns 1 if the object, o, provides numeric protocols, and
@@ -449,7 +449,7 @@
 
        */
 
-     PyObject *PyNumber_Add Py_PROTO((PyObject *o1, PyObject *o2));
+     DL_IMPORT(PyObject *) PyNumber_Add Py_PROTO((PyObject *o1, PyObject *o2));
 
        /*
 	 Returns the result of adding o1 and o2, or null on failure.
@@ -458,7 +458,7 @@
 
        */
 
-     PyObject *PyNumber_Subtract Py_PROTO((PyObject *o1, PyObject *o2));
+     DL_IMPORT(PyObject *) PyNumber_Subtract Py_PROTO((PyObject *o1, PyObject *o2));
 
        /*
 	 Returns the result of subtracting o2 from o1, or null on
@@ -467,7 +467,7 @@
 
        */
 
-     PyObject *PyNumber_Multiply Py_PROTO((PyObject *o1, PyObject *o2));
+     DL_IMPORT(PyObject *) PyNumber_Multiply Py_PROTO((PyObject *o1, PyObject *o2));
 
        /*
 	 Returns the result of multiplying o1 and o2, or null on
@@ -477,7 +477,7 @@
 
        */
 
-     PyObject *PyNumber_Divide Py_PROTO((PyObject *o1, PyObject *o2));
+     DL_IMPORT(PyObject *) PyNumber_Divide Py_PROTO((PyObject *o1, PyObject *o2));
 
        /*
 	 Returns the result of dividing o1 by o2, or null on failure.
@@ -486,7 +486,7 @@
 
        */
 
-     PyObject *PyNumber_Remainder Py_PROTO((PyObject *o1, PyObject *o2));
+     DL_IMPORT(PyObject *) PyNumber_Remainder Py_PROTO((PyObject *o1, PyObject *o2));
 
        /*
 	 Returns the remainder of dividing o1 by o2, or null on
@@ -496,7 +496,7 @@
 
        */
 
-     PyObject *PyNumber_Divmod Py_PROTO((PyObject *o1, PyObject *o2));
+     DL_IMPORT(PyObject *) PyNumber_Divmod Py_PROTO((PyObject *o1, PyObject *o2));
 
        /*
 	 See the built-in function divmod.  Returns NULL on failure.
@@ -506,7 +506,7 @@
 
        */
 
-     PyObject *PyNumber_Power Py_PROTO((PyObject *o1, PyObject *o2, PyObject *o3));
+     DL_IMPORT(PyObject *) PyNumber_Power Py_PROTO((PyObject *o1, PyObject *o2, PyObject *o3));
 
        /*
 	 See the built-in function pow.  Returns NULL on failure.
@@ -515,7 +515,7 @@
 
        */
 
-     PyObject *PyNumber_Negative Py_PROTO((PyObject *o));
+     DL_IMPORT(PyObject *) PyNumber_Negative Py_PROTO((PyObject *o));
 
        /*
 	 Returns the negation of o on success, or null on failure.
@@ -523,7 +523,7 @@
 
        */
 
-     PyObject *PyNumber_Positive Py_PROTO((PyObject *o));
+     DL_IMPORT(PyObject *) PyNumber_Positive Py_PROTO((PyObject *o));
 
        /*
          Returns the (what?) of o on success, or NULL on failure.
@@ -531,7 +531,7 @@
 
        */
 
-     PyObject *PyNumber_Absolute Py_PROTO((PyObject *o));
+     DL_IMPORT(PyObject *) PyNumber_Absolute Py_PROTO((PyObject *o));
 
        /*
 	 Returns the absolute value of o, or null on failure.  This is
@@ -539,7 +539,7 @@
 
        */
 
-     PyObject *PyNumber_Invert Py_PROTO((PyObject *o));
+     DL_IMPORT(PyObject *) PyNumber_Invert Py_PROTO((PyObject *o));
 
        /*
 	 Returns the bitwise negation of o on success, or NULL on
@@ -549,7 +549,7 @@
 
        */
 
-     PyObject *PyNumber_Lshift Py_PROTO((PyObject *o1, PyObject *o2));
+     DL_IMPORT(PyObject *) PyNumber_Lshift Py_PROTO((PyObject *o1, PyObject *o2));
 
        /*
 	 Returns the result of left shifting o1 by o2 on success, or
@@ -559,7 +559,7 @@
 
        */
 
-     PyObject *PyNumber_Rshift Py_PROTO((PyObject *o1, PyObject *o2));
+     DL_IMPORT(PyObject *) PyNumber_Rshift Py_PROTO((PyObject *o1, PyObject *o2));
 
        /*
 	 Returns the result of right shifting o1 by o2 on success, or
@@ -568,7 +568,7 @@
 
        */
 
-     PyObject *PyNumber_And Py_PROTO((PyObject *o1, PyObject *o2));
+     DL_IMPORT(PyObject *) PyNumber_And Py_PROTO((PyObject *o1, PyObject *o2));
 
        /*
 	 Returns the result of bitwise and of o1 and o2 on success, or
@@ -578,7 +578,7 @@
 
        */
 
-     PyObject *PyNumber_Xor Py_PROTO((PyObject *o1, PyObject *o2));
+     DL_IMPORT(PyObject *) PyNumber_Xor Py_PROTO((PyObject *o1, PyObject *o2));
 
        /*
 	 Returns the bitwise exclusive or of o1 by o2 on success, or
@@ -588,7 +588,7 @@
 
        */
 
-     PyObject *PyNumber_Or Py_PROTO((PyObject *o1, PyObject *o2));
+     DL_IMPORT(PyObject *) PyNumber_Or Py_PROTO((PyObject *o1, PyObject *o2));
 
        /*
 	 Returns the result of bitwise or or o1 and o2 on success, or
@@ -616,7 +616,7 @@
 
        */
 
-     PyObject *PyNumber_Int Py_PROTO((PyObject *o));
+     DL_IMPORT(PyObject *) PyNumber_Int Py_PROTO((PyObject *o));
 
        /*
 	 Returns the o converted to an integer object on success, or
@@ -625,7 +625,7 @@
 
        */
 
-     PyObject *PyNumber_Long Py_PROTO((PyObject *o));
+     DL_IMPORT(PyObject *) PyNumber_Long Py_PROTO((PyObject *o));
 
        /*
 	 Returns the o converted to a long integer object on success,
@@ -634,7 +634,7 @@
 
        */
 
-     PyObject *PyNumber_Float Py_PROTO((PyObject *o));
+     DL_IMPORT(PyObject *) PyNumber_Float Py_PROTO((PyObject *o));
 
        /*
 	 Returns the o converted to a float object on success, or NULL
@@ -645,7 +645,7 @@
 
 /*  Sequence protocol:*/
 
-     int PySequence_Check Py_PROTO((PyObject *o));
+     DL_IMPORT(int) PySequence_Check Py_PROTO((PyObject *o));
 
        /*
          Return 1 if the object provides sequence protocol, and zero
@@ -655,14 +655,14 @@
 
        */
 
-     int PySequence_Length Py_PROTO((PyObject *o));
+     DL_IMPORT(int) PySequence_Length Py_PROTO((PyObject *o));
 
        /*
          Return the length of sequence object o, or -1 on failure.
 
        */
 
-     PyObject *PySequence_Concat Py_PROTO((PyObject *o1, PyObject *o2));
+     DL_IMPORT(PyObject *) PySequence_Concat Py_PROTO((PyObject *o1, PyObject *o2));
 
        /*
 	 Return the concatination of o1 and o2 on success, and NULL on
@@ -671,7 +671,7 @@
 
        */
 
-     PyObject *PySequence_Repeat Py_PROTO((PyObject *o, int count));
+     DL_IMPORT(PyObject *) PySequence_Repeat Py_PROTO((PyObject *o, int count));
 
        /*
 	 Return the result of repeating sequence object o count times,
@@ -680,7 +680,7 @@
 
        */
 
-     PyObject *PySequence_GetItem Py_PROTO((PyObject *o, int i));
+     DL_IMPORT(PyObject *) PySequence_GetItem Py_PROTO((PyObject *o, int i));
 
        /*
 	 Return the ith element of o, or NULL on failure. This is the
@@ -688,7 +688,7 @@
 
        */
 
-     PyObject *PySequence_GetSlice Py_PROTO((PyObject *o, int i1, int i2));
+     DL_IMPORT(PyObject *) PySequence_GetSlice Py_PROTO((PyObject *o, int i1, int i2));
 
        /*
 	 Return the slice of sequence object o between i1 and i2, or
@@ -697,7 +697,7 @@
 
        */
 
-     int PySequence_SetItem Py_PROTO((PyObject *o, int i, PyObject *v));
+     DL_IMPORT(int) PySequence_SetItem Py_PROTO((PyObject *o, int i, PyObject *v));
 
        /*
 	 Assign object v to the ith element of o.  Returns
@@ -706,7 +706,7 @@
 
        */
 
-     int PySequence_DelItem Py_PROTO((PyObject *o, int i));
+     DL_IMPORT(int) PySequence_DelItem Py_PROTO((PyObject *o, int i));
 
        /*
 	 Delete the ith element of object v.  Returns
@@ -714,7 +714,7 @@
 	 statement: del o[i].
        */
 
-     int PySequence_SetSlice Py_PROTO((PyObject *o, int i1, int i2, PyObject *v));
+     DL_IMPORT(int) PySequence_SetSlice Py_PROTO((PyObject *o, int i1, int i2, PyObject *v));
 
        /*
          Assign the sequence object, v, to the slice in sequence
@@ -722,7 +722,7 @@
 	 equivalent of the Python statement: o[i1:i2]=v.
        */
 
-     int PySequence_DelSlice Py_PROTO((PyObject *o, int i1, int i2));
+     DL_IMPORT(int) PySequence_DelSlice Py_PROTO((PyObject *o, int i1, int i2));
 
        /*
 	 Delete the slice in sequence object, o, from i1 to i2.
@@ -730,21 +730,21 @@
 	 statement: del o[i1:i2].
        */
 
-     PyObject *PySequence_Tuple Py_PROTO((PyObject *o));
+     DL_IMPORT(PyObject *) PySequence_Tuple Py_PROTO((PyObject *o));
 
        /*
 	 Returns the sequence, o, as a tuple on success, and NULL on failure.
 	 This is equivalent to the Python expression: tuple(o)
        */
 
-     PyObject *PySequence_List Py_PROTO((PyObject *o));
+     DL_IMPORT(PyObject *) PySequence_List Py_PROTO((PyObject *o));
 
        /*
 	 Returns the sequence, o, as a list on success, and NULL on failure.
 	 This is equivalent to the Python expression: list(o)
        */
 
-     int PySequence_Count Py_PROTO((PyObject *o, PyObject *value));
+     DL_IMPORT(int) PySequence_Count Py_PROTO((PyObject *o, PyObject *value));
 
        /*
          Return the number of occurrences on value on o, that is,
@@ -753,7 +753,7 @@
 	 expression: o.count(value).
        */
 
-     int PySequence_Contains Py_PROTO((PyObject *o, PyObject *value));
+     DL_IMPORT(int) PySequence_Contains Py_PROTO((PyObject *o, PyObject *value));
 #define PySequence_In PySequence_Contains
 
        /*
@@ -762,7 +762,7 @@
 	 is equivalent to the Python expression: value in o.
        */
 
-     int PySequence_Index Py_PROTO((PyObject *o, PyObject *value));
+     DL_IMPORT(int) PySequence_Index Py_PROTO((PyObject *o, PyObject *value));
 
        /*
 	 Return the first index for which o[i]=value.  On error,
@@ -772,7 +772,7 @@
 
 /*  Mapping protocol:*/
 
-     int PyMapping_Check Py_PROTO((PyObject *o));
+     DL_IMPORT(int) PyMapping_Check Py_PROTO((PyObject *o));
 
        /*
          Return 1 if the object provides mapping protocol, and zero
@@ -781,7 +781,7 @@
 	 This function always succeeds.
        */
 
-     int PyMapping_Length Py_PROTO((PyObject *o));
+     DL_IMPORT(int) PyMapping_Length Py_PROTO((PyObject *o));
 
        /*
          Returns the number of keys in object o on success, and -1 on
@@ -809,7 +809,7 @@
        */
 #define PyMapping_DelItem(O,K) PyDict_DelItem((O),(K))
 
-     int PyMapping_HasKeyString Py_PROTO((PyObject *o, char *key));
+     DL_IMPORT(int) PyMapping_HasKeyString Py_PROTO((PyObject *o, char *key));
 
        /*
 	 On success, return 1 if the mapping object has the key, key,
@@ -819,7 +819,7 @@
 	 This function always succeeds.
        */
 
-     int PyMapping_HasKey Py_PROTO((PyObject *o, PyObject *key));
+     DL_IMPORT(int) PyMapping_HasKey Py_PROTO((PyObject *o, PyObject *key));
 
        /*
 	 Return 1 if the mapping object has the key, key,
@@ -862,7 +862,7 @@
        */
 #define PyMapping_Items(O) PyObject_CallMethod(O,"items",NULL)
 
-     PyObject *PyMapping_GetItemString Py_PROTO((PyObject *o, char *key));
+     DL_IMPORT(PyObject *) PyMapping_GetItemString Py_PROTO((PyObject *o, char *key));
 
        /*
 	 Return element of o corresponding to the object, key, or NULL
@@ -870,7 +870,7 @@
 	 o[key].
        */
 
-     int PyMapping_SetItemString Py_PROTO((PyObject *o, char *key,
+     DL_IMPORT(int) PyMapping_SetItemString Py_PROTO((PyObject *o, char *key,
 					   PyObject *value));
 
        /*
diff --git a/Include/bufferobject.h b/Include/bufferobject.h
index 62805e0..0bdc4c5 100644
--- a/Include/bufferobject.h
+++ b/Include/bufferobject.h
@@ -46,13 +46,13 @@
 
 #define Py_END_OF_BUFFER	(-1)
 
-extern PyObject *PyBuffer_FromObject Py_PROTO((PyObject *base, int offset, int size));
-extern PyObject *PyBuffer_FromReadWriteObject Py_PROTO((PyObject *base, int offset, int size));
+extern DL_IMPORT(PyObject *) PyBuffer_FromObject Py_PROTO((PyObject *base, int offset, int size));
+extern DL_IMPORT(PyObject *) PyBuffer_FromReadWriteObject Py_PROTO((PyObject *base, int offset, int size));
 
-extern PyObject *PyBuffer_FromMemory Py_PROTO((void *ptr, int size));
-extern PyObject *PyBuffer_FromReadWriteMemory Py_PROTO((void *ptr, int size));
+extern DL_IMPORT(PyObject *) PyBuffer_FromMemory Py_PROTO((void *ptr, int size));
+extern DL_IMPORT(PyObject *) PyBuffer_FromReadWriteMemory Py_PROTO((void *ptr, int size));
 
-extern PyObject *PyBuffer_New Py_PROTO((int size));
+extern DL_IMPORT(PyObject *) PyBuffer_New Py_PROTO((int size));
 
 #ifdef __cplusplus
 }
diff --git a/Include/cStringIO.h b/Include/cStringIO.h
index c1328de..53673ba 100644
--- a/Include/cStringIO.h
+++ b/Include/cStringIO.h
@@ -106,7 +106,7 @@
 #define PycStringIO_OutputCheck(O) \
   ((O)->ob_type==PycStringIO->OutputType)
 
-static void *
+static DL_IMPORT(void *)
 xxxPyCObject_Import(module_name, name)
   char *module_name;
   char *name;
diff --git a/Include/ceval.h b/Include/ceval.h
index 1805e36..5b96d9e 100644
--- a/Include/ceval.h
+++ b/Include/ceval.h
@@ -37,7 +37,7 @@
 
 /* Interface to random parts in ceval.c */
 
-PyObject *PyEval_CallObjectWithKeywords
+DL_IMPORT(PyObject *) PyEval_CallObjectWithKeywords
 	Py_PROTO((PyObject *, PyObject *, PyObject *));
 
 /* Inline this */
@@ -45,26 +45,26 @@
         PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
 
 #ifdef HAVE_STDARG_PROTOTYPES
-PyObject *PyEval_CallFunction Py_PROTO((PyObject *obj, char *format, ...));
-PyObject *PyEval_CallMethod Py_PROTO((PyObject *obj,
+DL_IMPORT(PyObject *) PyEval_CallFunction Py_PROTO((PyObject *obj, char *format, ...));
+DL_IMPORT(PyObject *) PyEval_CallMethod Py_PROTO((PyObject *obj,
 				      char *methodname, char *format, ...));
 #else
 /* Better to have no prototypes at all for varargs functions in this case */
-PyObject *PyEval_CallFunction();
-PyObject *PyEval_CallMethod();
+DL_IMPORT(PyObject *) PyEval_CallFunction();
+DL_IMPORT(PyObject *) PyEval_CallMethod();
 #endif
 
-PyObject *PyEval_GetBuiltins Py_PROTO((void));
-PyObject *PyEval_GetGlobals Py_PROTO((void));
-PyObject *PyEval_GetLocals Py_PROTO((void));
-PyObject *PyEval_GetOwner Py_PROTO((void));
-PyObject *PyEval_GetFrame Py_PROTO((void));
-int PyEval_GetRestricted Py_PROTO((void));
+DL_IMPORT(PyObject *) PyEval_GetBuiltins Py_PROTO((void));
+DL_IMPORT(PyObject *) PyEval_GetGlobals Py_PROTO((void));
+DL_IMPORT(PyObject *) PyEval_GetLocals Py_PROTO((void));
+DL_IMPORT(PyObject *) PyEval_GetOwner Py_PROTO((void));
+DL_IMPORT(PyObject *) PyEval_GetFrame Py_PROTO((void));
+DL_IMPORT(int) PyEval_GetRestricted Py_PROTO((void));
 
-int Py_FlushLine Py_PROTO((void));
+DL_IMPORT(int) Py_FlushLine Py_PROTO((void));
 
-int Py_AddPendingCall Py_PROTO((int (*func) Py_PROTO((ANY *)), ANY *arg));
-int Py_MakePendingCalls Py_PROTO((void));
+DL_IMPORT(int) Py_AddPendingCall Py_PROTO((int (*func) Py_PROTO((ANY *)), ANY *arg));
+DL_IMPORT(int) Py_MakePendingCalls Py_PROTO((void));
 
 
 /* Interface for threads.
@@ -112,16 +112,16 @@
    mechanism!
 */
 
-extern PyThreadState *PyEval_SaveThread Py_PROTO((void));
-extern void PyEval_RestoreThread Py_PROTO((PyThreadState *));
+extern DL_IMPORT(PyThreadState *) PyEval_SaveThread Py_PROTO((void));
+extern DL_IMPORT(void) PyEval_RestoreThread Py_PROTO((PyThreadState *));
 
 #ifdef WITH_THREAD
 
-extern void PyEval_InitThreads Py_PROTO((void));
-extern void PyEval_AcquireLock Py_PROTO((void));
-extern void PyEval_ReleaseLock Py_PROTO((void));
-extern void PyEval_AcquireThread Py_PROTO((PyThreadState *tstate));
-extern void PyEval_ReleaseThread Py_PROTO((PyThreadState *tstate));
+extern DL_IMPORT(void) PyEval_InitThreads Py_PROTO((void));
+extern DL_IMPORT(void) PyEval_AcquireLock Py_PROTO((void));
+extern DL_IMPORT(void) PyEval_ReleaseLock Py_PROTO((void));
+extern DL_IMPORT(void) PyEval_AcquireThread Py_PROTO((PyThreadState *tstate));
+extern DL_IMPORT(void) PyEval_ReleaseThread Py_PROTO((PyThreadState *tstate));
 
 #define Py_BEGIN_ALLOW_THREADS { \
 			PyThreadState *_save; \
diff --git a/Include/classobject.h b/Include/classobject.h
index e03f468..1a8c506 100644
--- a/Include/classobject.h
+++ b/Include/classobject.h
@@ -69,13 +69,13 @@
 #define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type)
 #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
 
-extern PyObject *PyClass_New Py_PROTO((PyObject *, PyObject *, PyObject *));
-extern PyObject *PyInstance_New Py_PROTO((PyObject *, PyObject *, PyObject *));
-extern PyObject *PyMethod_New Py_PROTO((PyObject *, PyObject *, PyObject *));
+extern DL_IMPORT(PyObject *) PyClass_New Py_PROTO((PyObject *, PyObject *, PyObject *));
+extern DL_IMPORT(PyObject *) PyInstance_New Py_PROTO((PyObject *, PyObject *, PyObject *));
+extern DL_IMPORT(PyObject *) PyMethod_New Py_PROTO((PyObject *, PyObject *, PyObject *));
 
-extern PyObject *PyMethod_Function Py_PROTO((PyObject *));
-extern PyObject *PyMethod_Self Py_PROTO((PyObject *));
-extern PyObject *PyMethod_Class Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyMethod_Function Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyMethod_Self Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyMethod_Class Py_PROTO((PyObject *));
 
 /* Macros for direct access to these values. Type checks are *not*
    done, so use with care. */
@@ -86,9 +86,9 @@
 #define PyMethod_GET_CLASS(meth) \
 	(((PyMethodObject *)meth) -> im_class)
 
-extern int PyClass_IsSubclass Py_PROTO((PyObject *, PyObject *));
+extern DL_IMPORT(int) PyClass_IsSubclass Py_PROTO((PyObject *, PyObject *));
 
-extern PyObject *PyInstance_DoBinOp
+extern DL_IMPORT(PyObject *) PyInstance_DoBinOp
 	Py_PROTO((PyObject *, PyObject *,
 		  char *, char *,
 		  PyObject * (*) Py_PROTO((PyObject *, PyObject *)) ));
diff --git a/Include/cobject.h b/Include/cobject.h
index 5979074..57a9cb9 100644
--- a/Include/cobject.h
+++ b/Include/cobject.h
@@ -54,7 +54,7 @@
    destroyed.
 
 */
-extern PyObject *
+extern DL_IMPORT(PyObject *)
 PyCObject_FromVoidPtr Py_PROTO((void *cobj, void (*destruct)(void*)));
 
 
@@ -63,20 +63,20 @@
    then it will be called with the first and second arguments if and when 
    the PyCObject is destroyed.
 */
-extern PyObject *
+extern DL_IMPORT(PyObject *)
 PyCObject_FromVoidPtrAndDesc Py_PROTO((void *cobj, void *desc,
                                        void (*destruct)(void*,void*)));
 
 /* Retrieve a pointer to a C object from a PyCObject. */
-extern void *
+extern DL_IMPORT(void *)
 PyCObject_AsVoidPtr Py_PROTO((PyObject *));
 
 /* Retrieve a pointer to a description object from a PyCObject. */
-extern void *
+extern DL_IMPORT(void *)
 PyCObject_GetDesc Py_PROTO((PyObject *));
 
 /* Import a pointer to a C object from a module using a PyCObject. */
-extern void *
+extern DL_IMPORT(void *)
 PyCObject_Import Py_PROTO((char *module_name, char *cobject_name));
 
 #ifdef __cplusplus
diff --git a/Include/compile.h b/Include/compile.h
index b735617..f2d1a9a 100644
--- a/Include/compile.h
+++ b/Include/compile.h
@@ -69,11 +69,11 @@
 
 /* Public interface */
 struct _node; /* Declare the existence of this type */
-PyCodeObject *PyNode_Compile Py_PROTO((struct _node *, char *));
-PyCodeObject *PyCode_New Py_PROTO((
+DL_IMPORT(PyCodeObject *) PyNode_Compile Py_PROTO((struct _node *, char *));
+DL_IMPORT(PyCodeObject *) PyCode_New Py_PROTO((
 	int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *,
 	PyObject *, PyObject *, int, PyObject *)); /* same as struct above */
-int PyCode_Addr2Line Py_PROTO((PyCodeObject *, int));
+DL_IMPORT(int) PyCode_Addr2Line Py_PROTO((PyCodeObject *, int));
 
 /* for internal use only */
 #define _PyCode_GETCODEPTR(co, pp) \
diff --git a/Include/complexobject.h b/Include/complexobject.h
index f5d8f43..ef62964 100644
--- a/Include/complexobject.h
+++ b/Include/complexobject.h
@@ -20,12 +20,12 @@
 #define c_quot _Py_c_quot
 #define c_pow _Py_c_pow
 
-extern Py_complex c_sum Py_PROTO((Py_complex, Py_complex));
-extern Py_complex c_diff Py_PROTO((Py_complex, Py_complex));
-extern Py_complex c_neg Py_PROTO((Py_complex));
-extern Py_complex c_prod Py_PROTO((Py_complex, Py_complex));
-extern Py_complex c_quot Py_PROTO((Py_complex, Py_complex));
-extern Py_complex c_pow Py_PROTO((Py_complex, Py_complex));
+extern DL_IMPORT(Py_complex) c_sum Py_PROTO((Py_complex, Py_complex));
+extern DL_IMPORT(Py_complex) c_diff Py_PROTO((Py_complex, Py_complex));
+extern DL_IMPORT(Py_complex) c_neg Py_PROTO((Py_complex));
+extern DL_IMPORT(Py_complex) c_prod Py_PROTO((Py_complex, Py_complex));
+extern DL_IMPORT(Py_complex) c_quot Py_PROTO((Py_complex, Py_complex));
+extern DL_IMPORT(Py_complex) c_pow Py_PROTO((Py_complex, Py_complex));
 
 
 /* Complex object interface */
@@ -44,12 +44,12 @@
 
 #define PyComplex_Check(op) ((op)->ob_type == &PyComplex_Type)
 
-extern PyObject *PyComplex_FromCComplex Py_PROTO((Py_complex));
-extern PyObject *PyComplex_FromDoubles Py_PROTO((double real, double imag));
+extern DL_IMPORT(PyObject *) PyComplex_FromCComplex Py_PROTO((Py_complex));
+extern DL_IMPORT(PyObject *) PyComplex_FromDoubles Py_PROTO((double real, double imag));
 
-extern double PyComplex_RealAsDouble Py_PROTO((PyObject *op));
-extern double PyComplex_ImagAsDouble Py_PROTO((PyObject *op));
-extern Py_complex PyComplex_AsCComplex Py_PROTO((PyObject *op));
+extern DL_IMPORT(double) PyComplex_RealAsDouble Py_PROTO((PyObject *op));
+extern DL_IMPORT(double) PyComplex_ImagAsDouble Py_PROTO((PyObject *op));
+extern DL_IMPORT(Py_complex) PyComplex_AsCComplex Py_PROTO((PyObject *op));
 
 #ifdef __cplusplus
 }
diff --git a/Include/dictobject.h b/Include/dictobject.h
index 31dcf43..1f1fdde 100644
--- a/Include/dictobject.h
+++ b/Include/dictobject.h
@@ -41,21 +41,21 @@
 
 #define PyDict_Check(op) ((op)->ob_type == &PyDict_Type)
 
-extern PyObject *PyDict_New Py_PROTO((void));
-extern PyObject *PyDict_GetItem Py_PROTO((PyObject *mp, PyObject *key));
-extern int PyDict_SetItem Py_PROTO((PyObject *mp, PyObject *key, PyObject *item));
-extern int PyDict_DelItem Py_PROTO((PyObject *mp, PyObject *key));
-extern void PyDict_Clear Py_PROTO((PyObject *mp));
-extern int PyDict_Next
+extern DL_IMPORT(PyObject *) PyDict_New Py_PROTO((void));
+extern DL_IMPORT(PyObject *) PyDict_GetItem Py_PROTO((PyObject *mp, PyObject *key));
+extern DL_IMPORT(int) PyDict_SetItem Py_PROTO((PyObject *mp, PyObject *key, PyObject *item));
+extern DL_IMPORT(int) PyDict_DelItem Py_PROTO((PyObject *mp, PyObject *key));
+extern DL_IMPORT(void) PyDict_Clear Py_PROTO((PyObject *mp));
+extern DL_IMPORT(int) PyDict_Next
 	Py_PROTO((PyObject *mp, int *pos, PyObject **key, PyObject **value));
-extern PyObject *PyDict_Keys Py_PROTO((PyObject *mp));
-extern PyObject *PyDict_Values Py_PROTO((PyObject *mp));
-extern PyObject *PyDict_Items Py_PROTO((PyObject *mp));
-extern int PyDict_Size Py_PROTO((PyObject *mp));
+extern DL_IMPORT(PyObject *) PyDict_Keys Py_PROTO((PyObject *mp));
+extern DL_IMPORT(PyObject *) PyDict_Values Py_PROTO((PyObject *mp));
+extern DL_IMPORT(PyObject *) PyDict_Items Py_PROTO((PyObject *mp));
+extern DL_IMPORT(int) PyDict_Size Py_PROTO((PyObject *mp));
 
-extern PyObject *PyDict_GetItemString Py_PROTO((PyObject *dp, char *key));
-extern int PyDict_SetItemString Py_PROTO((PyObject *dp, char *key, PyObject *item));
-extern int PyDict_DelItemString Py_PROTO((PyObject *dp, char *key));
+extern DL_IMPORT(PyObject *) PyDict_GetItemString Py_PROTO((PyObject *dp, char *key));
+extern DL_IMPORT(int) PyDict_SetItemString Py_PROTO((PyObject *dp, char *key, PyObject *item));
+extern DL_IMPORT(int) PyDict_DelItemString Py_PROTO((PyObject *dp, char *key));
 
 #ifdef __cplusplus
 }
diff --git a/Include/eval.h b/Include/eval.h
index aeff7d3..62dd241 100644
--- a/Include/eval.h
+++ b/Include/eval.h
@@ -37,7 +37,7 @@
 
 /* Interface to execute compiled code */
 
-PyObject *PyEval_EvalCode Py_PROTO((PyCodeObject *, PyObject *, PyObject *));
+DL_IMPORT(PyObject *) PyEval_EvalCode Py_PROTO((PyCodeObject *, PyObject *, PyObject *));
 
 #ifdef __cplusplus
 }
diff --git a/Include/fileobject.h b/Include/fileobject.h
index d5e7b8c..30d3ae0 100644
--- a/Include/fileobject.h
+++ b/Include/fileobject.h
@@ -41,16 +41,16 @@
 
 #define PyFile_Check(op) ((op)->ob_type == &PyFile_Type)
 
-extern PyObject *PyFile_FromString Py_PROTO((char *, char *));
-extern void PyFile_SetBufSize Py_PROTO((PyObject *, int));
-extern PyObject *PyFile_FromFile
+extern DL_IMPORT(PyObject *) PyFile_FromString Py_PROTO((char *, char *));
+extern DL_IMPORT(void) PyFile_SetBufSize Py_PROTO((PyObject *, int));
+extern DL_IMPORT(PyObject *) PyFile_FromFile
 	Py_PROTO((FILE *, char *, char *, int (*)Py_FPROTO((FILE *))));
-extern FILE *PyFile_AsFile Py_PROTO((PyObject *));
-extern PyObject *PyFile_Name Py_PROTO((PyObject *));
-extern PyObject *PyFile_GetLine Py_PROTO((PyObject *, int));
-extern int PyFile_WriteObject Py_PROTO((PyObject *, PyObject *, int));
-extern int PyFile_SoftSpace Py_PROTO((PyObject *, int));
-extern int PyFile_WriteString Py_PROTO((char *, PyObject *));
+extern DL_IMPORT(FILE *) PyFile_AsFile Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyFile_Name Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyFile_GetLine Py_PROTO((PyObject *, int));
+extern DL_IMPORT(int) PyFile_WriteObject Py_PROTO((PyObject *, PyObject *, int));
+extern DL_IMPORT(int) PyFile_SoftSpace Py_PROTO((PyObject *, int));
+extern DL_IMPORT(int) PyFile_WriteString Py_PROTO((char *, PyObject *));
 
 #ifdef __cplusplus
 }
diff --git a/Include/floatobject.h b/Include/floatobject.h
index c4a356a..4491f59 100644
--- a/Include/floatobject.h
+++ b/Include/floatobject.h
@@ -50,8 +50,8 @@
 
 #define PyFloat_Check(op) ((op)->ob_type == &PyFloat_Type)
 
-extern PyObject *PyFloat_FromDouble Py_PROTO((double));
-extern double PyFloat_AsDouble Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyFloat_FromDouble Py_PROTO((double));
+extern DL_IMPORT(double) PyFloat_AsDouble Py_PROTO((PyObject *));
 
 /* Macro, trading safety for speed */
 #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
diff --git a/Include/frameobject.h b/Include/frameobject.h
index 157cba3..29b0d44 100644
--- a/Include/frameobject.h
+++ b/Include/frameobject.h
@@ -72,7 +72,7 @@
 
 #define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type)
 
-PyFrameObject * PyFrame_New
+DL_IMPORT(PyFrameObject *) PyFrame_New
 	Py_PROTO((PyThreadState *, PyCodeObject *,
 		  PyObject *, PyObject *));
 
@@ -101,17 +101,17 @@
 
 /* Block management functions */
 
-void PyFrame_BlockSetup Py_PROTO((PyFrameObject *, int, int, int));
-PyTryBlock *PyFrame_BlockPop Py_PROTO((PyFrameObject *));
+DL_IMPORT(void) PyFrame_BlockSetup Py_PROTO((PyFrameObject *, int, int, int));
+DL_IMPORT(PyTryBlock *) PyFrame_BlockPop Py_PROTO((PyFrameObject *));
 
 /* Extend the value stack */
 
-PyObject **PyFrame_ExtendStack Py_PROTO((PyFrameObject *, int, int));
+DL_IMPORT(PyObject **) PyFrame_ExtendStack Py_PROTO((PyFrameObject *, int, int));
 
 /* Conversions between "fast locals" and locals in dictionary */
 
-void PyFrame_LocalsToFast Py_PROTO((PyFrameObject *, int));
-void PyFrame_FastToLocals Py_PROTO((PyFrameObject *));
+DL_IMPORT(void) PyFrame_LocalsToFast Py_PROTO((PyFrameObject *, int));
+DL_IMPORT(void) PyFrame_FastToLocals Py_PROTO((PyFrameObject *));
 
 #ifdef __cplusplus
 }
diff --git a/Include/funcobject.h b/Include/funcobject.h
index a8834a7..fba40a5 100644
--- a/Include/funcobject.h
+++ b/Include/funcobject.h
@@ -50,11 +50,11 @@
 
 #define PyFunction_Check(op) ((op)->ob_type == &PyFunction_Type)
 
-extern PyObject *PyFunction_New Py_PROTO((PyObject *, PyObject *));
-extern PyObject *PyFunction_GetCode Py_PROTO((PyObject *));
-extern PyObject *PyFunction_GetGlobals Py_PROTO((PyObject *));
-extern PyObject *PyFunction_GetDefaults Py_PROTO((PyObject *));
-extern int PyFunction_SetDefaults Py_PROTO((PyObject *, PyObject *));
+extern DL_IMPORT(PyObject *) PyFunction_New Py_PROTO((PyObject *, PyObject *));
+extern DL_IMPORT(PyObject *) PyFunction_GetCode Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyFunction_GetGlobals Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyFunction_GetDefaults Py_PROTO((PyObject *));
+extern DL_IMPORT(int) PyFunction_SetDefaults Py_PROTO((PyObject *, PyObject *));
 
 /* Macros for direct access to these values. Type checks are *not*
    done, so use with care. */
diff --git a/Include/import.h b/Include/import.h
index 2b59b51..0d99fae 100644
--- a/Include/import.h
+++ b/Include/import.h
@@ -37,26 +37,26 @@
 
 /* Module definition and import interface */
 
-long PyImport_GetMagicNumber Py_PROTO((void));
-PyObject *PyImport_ExecCodeModule Py_PROTO((char *name, PyObject *co));
-PyObject *PyImport_ExecCodeModuleEx Py_PROTO((
+DL_IMPORT(long) PyImport_GetMagicNumber Py_PROTO((void));
+DL_IMPORT(PyObject *) PyImport_ExecCodeModule Py_PROTO((char *name, PyObject *co));
+DL_IMPORT(PyObject *) PyImport_ExecCodeModuleEx Py_PROTO((
 	char *name, PyObject *co, char *pathname));
-PyObject *PyImport_GetModuleDict Py_PROTO((void));
-PyObject *PyImport_AddModule Py_PROTO((char *name));
-PyObject *PyImport_ImportModule Py_PROTO((char *name));
-PyObject *PyImport_ImportModuleEx Py_PROTO((
+DL_IMPORT(PyObject *) PyImport_GetModuleDict Py_PROTO((void));
+DL_IMPORT(PyObject *) PyImport_AddModule Py_PROTO((char *name));
+DL_IMPORT(PyObject *) PyImport_ImportModule Py_PROTO((char *name));
+DL_IMPORT(PyObject *) PyImport_ImportModuleEx Py_PROTO((
 	char *name, PyObject *globals, PyObject *locals, PyObject *fromlist));
-PyObject *PyImport_Import Py_PROTO((PyObject *name));
-PyObject *PyImport_ReloadModule Py_PROTO((PyObject *m));
-void PyImport_Cleanup Py_PROTO((void));
-int PyImport_ImportFrozenModule Py_PROTO((char *));
+DL_IMPORT(PyObject *) PyImport_Import Py_PROTO((PyObject *name));
+DL_IMPORT(PyObject *) PyImport_ReloadModule Py_PROTO((PyObject *m));
+DL_IMPORT(void) PyImport_Cleanup Py_PROTO((void));
+DL_IMPORT(int) PyImport_ImportFrozenModule Py_PROTO((char *));
 
-extern PyObject *_PyImport_FindExtension Py_PROTO((char *, char *));
-extern PyObject *_PyImport_FixupExtension Py_PROTO((char *, char *));
+extern DL_IMPORT(PyObject *)_PyImport_FindExtension Py_PROTO((char *, char *));
+extern DL_IMPORT(PyObject *)_PyImport_FixupExtension Py_PROTO((char *, char *));
 
 #ifdef __BEOS__
 #include <kernel/image.h>
-extern image_id PyImport_BeImageID( char *name );
+extern DL_IMPORT(image_id) PyImport_BeImageID( char *name );
 #endif
 
 struct _inittab {
@@ -66,8 +66,8 @@
 
 extern DL_IMPORT(struct _inittab *) PyImport_Inittab;
 
-extern int PyImport_AppendInittab Py_PROTO((char *name, void (*initfunc)()));
-extern int PyImport_ExtendInittab Py_PROTO((struct _inittab *newtab));
+extern DL_IMPORT(int) PyImport_AppendInittab Py_PROTO((char *name, void (*initfunc)()));
+extern DL_IMPORT(int) PyImport_ExtendInittab Py_PROTO((struct _inittab *newtab));
 
 struct _frozen {
 	char *name;
diff --git a/Include/intobject.h b/Include/intobject.h
index cd66f75..2d3e750 100644
--- a/Include/intobject.h
+++ b/Include/intobject.h
@@ -61,9 +61,9 @@
 
 #define PyInt_Check(op) ((op)->ob_type == &PyInt_Type)
 
-extern PyObject *PyInt_FromLong Py_PROTO((long));
-extern long PyInt_AsLong Py_PROTO((PyObject *));
-extern long PyInt_GetMax Py_PROTO((void));
+extern DL_IMPORT(PyObject *) PyInt_FromLong Py_PROTO((long));
+extern DL_IMPORT(long) PyInt_AsLong Py_PROTO((PyObject *));
+extern DL_IMPORT(long) PyInt_GetMax Py_PROTO((void));
 
 
 /*
diff --git a/Include/intrcheck.h b/Include/intrcheck.h
index 8566051..6bff23e 100644
--- a/Include/intrcheck.h
+++ b/Include/intrcheck.h
@@ -35,9 +35,9 @@
 
 ******************************************************************/
 
-extern int PyOS_InterruptOccurred Py_PROTO((void));
-extern void PyOS_InitInterrupts Py_PROTO((void));
-void PyOS_AfterFork Py_PROTO((void));
+extern DL_IMPORT(int) PyOS_InterruptOccurred Py_PROTO((void));
+extern DL_IMPORT(void) PyOS_InitInterrupts Py_PROTO((void));
+DL_IMPORT(void) PyOS_AfterFork Py_PROTO((void));
 
 #ifdef __cplusplus
 }
diff --git a/Include/listobject.h b/Include/listobject.h
index e99acef..dfbc6af 100644
--- a/Include/listobject.h
+++ b/Include/listobject.h
@@ -60,17 +60,17 @@
 
 #define PyList_Check(op) ((op)->ob_type == &PyList_Type)
 
-extern PyObject *PyList_New Py_PROTO((int size));
-extern int PyList_Size Py_PROTO((PyObject *));
-extern PyObject *PyList_GetItem Py_PROTO((PyObject *, int));
-extern int PyList_SetItem Py_PROTO((PyObject *, int, PyObject *));
-extern int PyList_Insert Py_PROTO((PyObject *, int, PyObject *));
-extern int PyList_Append Py_PROTO((PyObject *, PyObject *));
-extern PyObject *PyList_GetSlice Py_PROTO((PyObject *, int, int));
-extern int PyList_SetSlice Py_PROTO((PyObject *, int, int, PyObject *));
-extern int PyList_Sort Py_PROTO((PyObject *));
-extern int PyList_Reverse Py_PROTO((PyObject *));
-extern PyObject *PyList_AsTuple Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyList_New Py_PROTO((int size));
+extern DL_IMPORT(int) PyList_Size Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyList_GetItem Py_PROTO((PyObject *, int));
+extern DL_IMPORT(int) PyList_SetItem Py_PROTO((PyObject *, int, PyObject *));
+extern DL_IMPORT(int) PyList_Insert Py_PROTO((PyObject *, int, PyObject *));
+extern DL_IMPORT(int) PyList_Append Py_PROTO((PyObject *, PyObject *));
+extern DL_IMPORT(PyObject *) PyList_GetSlice Py_PROTO((PyObject *, int, int));
+extern DL_IMPORT(int) PyList_SetSlice Py_PROTO((PyObject *, int, int, PyObject *));
+extern DL_IMPORT(int) PyList_Sort Py_PROTO((PyObject *));
+extern DL_IMPORT(int) PyList_Reverse Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyList_AsTuple Py_PROTO((PyObject *));
 
 /* Macro, trading safety for speed */
 #define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
diff --git a/Include/longintrepr.h b/Include/longintrepr.h
index 3630bd7..e96cfce 100644
--- a/Include/longintrepr.h
+++ b/Include/longintrepr.h
@@ -73,7 +73,7 @@
 	digit ob_digit[1];
 };
 
-PyLongObject *_PyLong_New Py_PROTO((int));
+DL_IMPORT(PyLongObject *) _PyLong_New Py_PROTO((int));
 
 #ifdef __cplusplus
 }
diff --git a/Include/longobject.h b/Include/longobject.h
index afb8af1..46105ae 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -43,26 +43,26 @@
 
 #define PyLong_Check(op) ((op)->ob_type == &PyLong_Type)
 
-extern PyObject *PyLong_FromLong Py_PROTO((long));
-extern PyObject *PyLong_FromUnsignedLong Py_PROTO((unsigned long));
-extern PyObject *PyLong_FromDouble Py_PROTO((double));
-extern long PyLong_AsLong Py_PROTO((PyObject *));
-extern unsigned long PyLong_AsUnsignedLong Py_PROTO((PyObject *));
-extern double PyLong_AsDouble Py_PROTO((PyObject *));
-extern PyObject *PyLong_FromVoidPtr Py_PROTO((void *));
-extern void *PyLong_AsVoidPtr Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyLong_FromLong Py_PROTO((long));
+extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLong Py_PROTO((unsigned long));
+extern DL_IMPORT(PyObject *) PyLong_FromDouble Py_PROTO((double));
+extern DL_IMPORT(long) PyLong_AsLong Py_PROTO((PyObject *));
+extern DL_IMPORT(unsigned long) PyLong_AsUnsignedLong Py_PROTO((PyObject *));
+extern DL_IMPORT(double) PyLong_AsDouble Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyLong_FromVoidPtr Py_PROTO((void *));
+extern DL_IMPORT(void *) PyLong_AsVoidPtr Py_PROTO((PyObject *));
 
 #ifdef HAVE_LONG_LONG
 #ifndef LONG_LONG
 #define LONG_LONG long long
 #endif
-extern PyObject *PyLong_FromLongLong Py_PROTO((LONG_LONG));
-extern PyObject *PyLong_FromUnsignedLongLong Py_PROTO((unsigned LONG_LONG));
-extern LONG_LONG PyLong_AsLongLong Py_PROTO((PyObject *));
-extern unsigned LONG_LONG PyLong_AsUnsignedLongLong Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyLong_FromLongLong Py_PROTO((LONG_LONG));
+extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLongLong Py_PROTO((unsigned LONG_LONG));
+extern DL_IMPORT(LONG_LONG) PyLong_AsLongLong Py_PROTO((PyObject *));
+extern DL_IMPORT(unsigned LONG_LONG) PyLong_AsUnsignedLongLong Py_PROTO((PyObject *));
 #endif /* HAVE_LONG_LONG */
 
-PyObject *PyLong_FromString Py_PROTO((char *, char **, int));
+DL_IMPORT(PyObject *) PyLong_FromString Py_PROTO((char *, char **, int));
 
 #ifdef __cplusplus
 }
diff --git a/Include/marshal.h b/Include/marshal.h
index eb7eaf6..e388274 100644
--- a/Include/marshal.h
+++ b/Include/marshal.h
@@ -37,15 +37,15 @@
 
 /* Interface for marshal.c */
 
-void PyMarshal_WriteLongToFile Py_PROTO((long, FILE *));
-void PyMarshal_WriteShortToFile Py_PROTO((int, FILE *));
-void PyMarshal_WriteObjectToFile Py_PROTO((PyObject *, FILE *));
-PyObject *PyMarshal_WriteObjectToString Py_PROTO((PyObject *));
+DL_IMPORT(void) PyMarshal_WriteLongToFile Py_PROTO((long, FILE *));
+DL_IMPORT(void) PyMarshal_WriteShortToFile Py_PROTO((int, FILE *));
+DL_IMPORT(void) PyMarshal_WriteObjectToFile Py_PROTO((PyObject *, FILE *));
+DL_IMPORT(PyObject *) PyMarshal_WriteObjectToString Py_PROTO((PyObject *));
 
-long PyMarshal_ReadLongFromFile Py_PROTO((FILE *));
-int PyMarshal_ReadShortFromFile Py_PROTO((FILE *));
-PyObject *PyMarshal_ReadObjectFromFile Py_PROTO((FILE *));
-PyObject *PyMarshal_ReadObjectFromString Py_PROTO((char *, int));
+DL_IMPORT(long) PyMarshal_ReadLongFromFile Py_PROTO((FILE *));
+DL_IMPORT(int) PyMarshal_ReadShortFromFile Py_PROTO((FILE *));
+DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromFile Py_PROTO((FILE *));
+DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromString Py_PROTO((char *, int));
 
 #ifdef __cplusplus
 }
diff --git a/Include/methodobject.h b/Include/methodobject.h
index 2b4819f..e614687 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -45,9 +45,9 @@
 typedef PyObject *(*PyCFunctionWithKeywords)
 	Py_FPROTO((PyObject *, PyObject *, PyObject *));
 
-extern PyCFunction PyCFunction_GetFunction Py_PROTO((PyObject *));
-extern PyObject *PyCFunction_GetSelf Py_PROTO((PyObject *));
-extern int PyCFunction_GetFlags Py_PROTO((PyObject *));
+extern DL_IMPORT(PyCFunction) PyCFunction_GetFunction Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyCFunction_GetSelf Py_PROTO((PyObject *));
+extern DL_IMPORT(int) PyCFunction_GetFlags Py_PROTO((PyObject *));
 
 /* Macros for direct access to these values. Type checks are *not*
    done, so use with care. */
@@ -66,10 +66,10 @@
 };
 typedef struct PyMethodDef PyMethodDef;
 
-extern PyObject *Py_FindMethod
+extern DL_IMPORT(PyObject *) Py_FindMethod
 	Py_PROTO((PyMethodDef[], PyObject *, char *));
 
-extern PyObject *PyCFunction_New
+extern DL_IMPORT(PyObject *) PyCFunction_New
 	Py_PROTO((PyMethodDef *, PyObject *));
 
 /* Flag passed to newmethodobject */
@@ -81,7 +81,7 @@
 	struct PyMethodChain *link;	/* NULL or base type */
 } PyMethodChain;
 
-extern PyObject *Py_FindMethodInChain
+extern DL_IMPORT(PyObject *) Py_FindMethodInChain
 	Py_PROTO((PyMethodChain *, PyObject *, char *));
 
 typedef struct {
diff --git a/Include/modsupport.h b/Include/modsupport.h
index 91951bd..f096750 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -41,25 +41,25 @@
 
 #include <stdarg.h>
 
-extern int PyArg_Parse Py_PROTO((PyObject *, char *, ...));
-extern int PyArg_ParseTuple Py_PROTO((PyObject *, char *, ...));
-extern int PyArg_ParseTupleAndKeywords Py_PROTO((PyObject *, PyObject *,
+extern DL_IMPORT(int) PyArg_Parse Py_PROTO((PyObject *, char *, ...));
+extern DL_IMPORT(int) PyArg_ParseTuple Py_PROTO((PyObject *, char *, ...));
+extern DL_IMPORT(int) PyArg_ParseTupleAndKeywords Py_PROTO((PyObject *, PyObject *,
 						 char *, char **, ...));
-extern PyObject *Py_BuildValue Py_PROTO((char *, ...));
+extern DL_IMPORT(PyObject *) Py_BuildValue Py_PROTO((char *, ...));
 
 #else
 
 #include <varargs.h>
 
 /* Better to have no prototypes at all for varargs functions in this case */
-extern int PyArg_Parse();
-extern int PyArg_ParseTuple();
-extern PyObject *Py_BuildValue();
+extern DL_IMPORT(int) PyArg_Parse();
+extern DL_IMPORT(int) PyArg_ParseTuple();
+extern DL_IMPORT(PyObject *) Py_BuildValue();
 
 #endif
 
-extern int PyArg_VaParse Py_PROTO((PyObject *, char *, va_list));
-extern PyObject *Py_VaBuildValue Py_PROTO((char *, va_list));
+extern DL_IMPORT(int) PyArg_VaParse Py_PROTO((PyObject *, char *, va_list));
+extern DL_IMPORT(PyObject *) Py_VaBuildValue Py_PROTO((char *, va_list));
 
 #define PYTHON_API_VERSION 1008
 #define PYTHON_API_STRING "1008"
@@ -107,7 +107,7 @@
 #define Py_InitModule4 Py_InitModule4TraceRefs
 #endif
 
-extern PyObject *Py_InitModule4 Py_PROTO((char *, PyMethodDef *,
+extern DL_IMPORT(PyObject *) Py_InitModule4 Py_PROTO((char *, PyMethodDef *,
 					  char *, PyObject *, int));
 #define Py_InitModule(name, methods) \
 	Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
@@ -117,7 +117,7 @@
 	Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
 		       PYTHON_API_VERSION)
 
-extern char *_Py_PackageContext;
+extern DL_IMPORT(char *) _Py_PackageContext;
 
 #ifdef __cplusplus
 }
diff --git a/Include/moduleobject.h b/Include/moduleobject.h
index 03bc9f7..694343a 100644
--- a/Include/moduleobject.h
+++ b/Include/moduleobject.h
@@ -41,10 +41,10 @@
 
 #define PyModule_Check(op) ((op)->ob_type == &PyModule_Type)
 
-extern PyObject *PyModule_New Py_PROTO((char *));
-extern PyObject *PyModule_GetDict Py_PROTO((PyObject *));
-extern char *PyModule_GetName Py_PROTO((PyObject *));
-extern void _PyModule_Clear Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyModule_New Py_PROTO((char *));
+extern DL_IMPORT(PyObject *) PyModule_GetDict Py_PROTO((PyObject *));
+extern DL_IMPORT(char *) PyModule_GetName Py_PROTO((PyObject *));
+extern DL_IMPORT(void) _PyModule_Clear Py_PROTO((PyObject *));
 
 #ifdef __cplusplus
 }
diff --git a/Include/mymalloc.h b/Include/mymalloc.h
index b65523e..558af9d 100644
--- a/Include/mymalloc.h
+++ b/Include/mymalloc.h
@@ -106,14 +106,14 @@
    The Python interpreter continues to use PyMem_NEW etc. */
 
 /* These wrappers around malloc call PyErr_NoMemory() on failure */
-extern ANY *Py_Malloc Py_PROTO((size_t));
-extern ANY *Py_Realloc Py_PROTO((ANY *, size_t));
-extern void Py_Free Py_PROTO((ANY *));
+extern DL_IMPORT(ANY *) Py_Malloc Py_PROTO((size_t));
+extern DL_IMPORT(ANY *) Py_Realloc Py_PROTO((ANY *, size_t));
+extern DL_IMPORT(void) Py_Free Py_PROTO((ANY *));
 
 /* These wrappers around malloc *don't* call anything on failure */
-extern ANY *PyMem_Malloc Py_PROTO((size_t));
-extern ANY *PyMem_Realloc Py_PROTO((ANY *, size_t));
-extern void PyMem_Free Py_PROTO((ANY *));
+extern DL_IMPORT(ANY *) PyMem_Malloc Py_PROTO((size_t));
+extern DL_IMPORT(ANY *) PyMem_Realloc Py_PROTO((ANY *, size_t));
+extern DL_IMPORT(void) PyMem_Free Py_PROTO((ANY *));
 
 #ifdef __cplusplus
 }
diff --git a/Include/node.h b/Include/node.h
index 0575f4a..7f30923 100644
--- a/Include/node.h
+++ b/Include/node.h
@@ -45,9 +45,9 @@
 	struct _node	*n_child;
 } node;
 
-extern node *PyNode_New Py_PROTO((int type));
-extern node *PyNode_AddChild Py_PROTO((node *n, int type, char *str, int lineno));
-extern void PyNode_Free Py_PROTO((node *n));
+extern DL_IMPORT(node *) PyNode_New Py_PROTO((int type));
+extern DL_IMPORT(node *) PyNode_AddChild Py_PROTO((node *n, int type, char *str, int lineno));
+extern DL_IMPORT(void) PyNode_Free Py_PROTO((node *n));
 
 /* Node access functions */
 #define NCH(n)		((n)->n_nchildren)
@@ -67,7 +67,7 @@
 	} }
 #endif
 
-extern void PyNode_ListTree Py_PROTO((node *));
+extern DL_IMPORT(void) PyNode_ListTree Py_PROTO((node *));
 
 #ifdef __cplusplus
 }
diff --git a/Include/object.h b/Include/object.h
index 136e202..de3f502 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -267,26 +267,26 @@
 #define PyType_Check(op) ((op)->ob_type == &PyType_Type)
 
 /* Generic operations on objects */
-extern int PyObject_Print Py_PROTO((PyObject *, FILE *, int));
-extern PyObject * PyObject_Repr Py_PROTO((PyObject *));
-extern PyObject * PyObject_Str Py_PROTO((PyObject *));
-extern int PyObject_Compare Py_PROTO((PyObject *, PyObject *));
-extern PyObject *PyObject_GetAttrString Py_PROTO((PyObject *, char *));
-extern int PyObject_SetAttrString Py_PROTO((PyObject *, char *, PyObject *));
-extern int PyObject_HasAttrString Py_PROTO((PyObject *, char *));
-extern PyObject *PyObject_GetAttr Py_PROTO((PyObject *, PyObject *));
-extern int PyObject_SetAttr Py_PROTO((PyObject *, PyObject *, PyObject *));
-extern int PyObject_HasAttr Py_PROTO((PyObject *, PyObject *));
-extern long PyObject_Hash Py_PROTO((PyObject *));
-extern int PyObject_IsTrue Py_PROTO((PyObject *));
-extern int PyObject_Not Py_PROTO((PyObject *));
-extern int PyCallable_Check Py_PROTO((PyObject *));
-extern int PyNumber_Coerce Py_PROTO((PyObject **, PyObject **));
-extern int PyNumber_CoerceEx Py_PROTO((PyObject **, PyObject **));
+extern DL_IMPORT(int) PyObject_Print Py_PROTO((PyObject *, FILE *, int));
+extern DL_IMPORT(PyObject *) PyObject_Repr Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyObject_Str Py_PROTO((PyObject *));
+extern DL_IMPORT(int) PyObject_Compare Py_PROTO((PyObject *, PyObject *));
+extern DL_IMPORT(PyObject *) PyObject_GetAttrString Py_PROTO((PyObject *, char *));
+extern DL_IMPORT(int) PyObject_SetAttrString Py_PROTO((PyObject *, char *, PyObject *));
+extern DL_IMPORT(int) PyObject_HasAttrString Py_PROTO((PyObject *, char *));
+extern DL_IMPORT(PyObject *) PyObject_GetAttr Py_PROTO((PyObject *, PyObject *));
+extern DL_IMPORT(int) PyObject_SetAttr Py_PROTO((PyObject *, PyObject *, PyObject *));
+extern DL_IMPORT(int) PyObject_HasAttr Py_PROTO((PyObject *, PyObject *));
+extern DL_IMPORT(long) PyObject_Hash Py_PROTO((PyObject *));
+extern DL_IMPORT(int) PyObject_IsTrue Py_PROTO((PyObject *));
+extern DL_IMPORT(int) PyObject_Not Py_PROTO((PyObject *));
+extern DL_IMPORT(int) PyCallable_Check Py_PROTO((PyObject *));
+extern DL_IMPORT(int) PyNumber_Coerce Py_PROTO((PyObject **, PyObject **));
+extern DL_IMPORT(int) PyNumber_CoerceEx Py_PROTO((PyObject **, PyObject **));
 
 /* Helpers for printing recursive container types */
-extern int Py_ReprEnter Py_PROTO((PyObject *));
-extern void Py_ReprLeave Py_PROTO((PyObject *));
+extern DL_IMPORT(int) Py_ReprEnter Py_PROTO((PyObject *));
+extern DL_IMPORT(void) Py_ReprLeave Py_PROTO((PyObject *));
 
 /* Flag bits for printing: */
 #define Py_PRINT_RAW	1	/* No string quotes etc. */
@@ -358,10 +358,10 @@
 #endif
 
 #ifdef Py_TRACE_REFS
-extern void _Py_Dealloc Py_PROTO((PyObject *));
-extern void _Py_NewReference Py_PROTO((PyObject *));
-extern void _Py_ForgetReference Py_PROTO((PyObject *));
-extern void _Py_PrintReferences Py_PROTO((FILE *));
+extern DL_IMPORT(void) _Py_Dealloc Py_PROTO((PyObject *));
+extern DL_IMPORT(void) _Py_NewReference Py_PROTO((PyObject *));
+extern DL_IMPORT(void) _Py_ForgetReference Py_PROTO((PyObject *));
+extern DL_IMPORT(void) _Py_PrintReferences Py_PROTO((FILE *));
 #endif
 
 #ifndef Py_TRACE_REFS
@@ -375,12 +375,12 @@
 #endif /* !Py_TRACE_REFS */
 
 #ifdef COUNT_ALLOCS
-extern void inc_count Py_PROTO((PyTypeObject *));
+extern DL_IMPORT(void) inc_count Py_PROTO((PyTypeObject *));
 #endif
 
 #ifdef Py_REF_DEBUG
 
-extern long _Py_RefTotal;
+extern DL_IMPORT(long) _Py_RefTotal;
 
 #ifndef Py_TRACE_REFS
 #ifdef COUNT_ALLOCS
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 77177d0..84cee20 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -55,8 +55,8 @@
 */
 
 #ifndef MS_COREDLL
-extern PyObject *_PyObject_New Py_PROTO((PyTypeObject *));
-extern PyVarObject *_PyObject_NewVar Py_PROTO((PyTypeObject *, int));
+extern DL_IMPORT(PyObject *) _PyObject_New Py_PROTO((PyTypeObject *));
+extern DL_IMPORT(PyVarObject *) _PyObject_NewVar Py_PROTO((PyTypeObject *, int));
 
 #define PyObject_NEW(type, typeobj) ((type *) _PyObject_New(typeobj))
 #define PyObject_NEW_VAR(type, typeobj, n) ((type *) _PyObject_NewVar(typeobj, n))
@@ -66,8 +66,8 @@
    extension module's malloc is used, rather than the core DLL malloc, as there is
    no guarantee they will use the same heap
 */
-extern PyObject *_PyObject_New Py_PROTO((PyTypeObject *, PyObject *));
-extern PyVarObject *_PyObject_NewVar Py_PROTO((PyTypeObject *, int, PyVarObject *));
+extern DL_IMPORT(PyObject *) _PyObject_New Py_PROTO((PyTypeObject *, PyObject *));
+extern DL_IMPORT(PyVarObject *) _PyObject_NewVar Py_PROTO((PyTypeObject *, int, PyVarObject *));
 
 #define PyObject_NEW(type, typeobj) ((type *) _PyObject_New(typeobj,(PyObject *)malloc((typeobj)->tp_basicsize)))
 #define PyObject_NEW_VAR(type, typeobj, n) ((type *) _PyObject_NewVar(typeobj, n, (PyVarObject *)malloc((typeobj)->tp_basicsize + n * (typeobj)->tp_itemsize)))
diff --git a/Include/parsetok.h b/Include/parsetok.h
index 22347ab..d079e9f 100644
--- a/Include/parsetok.h
+++ b/Include/parsetok.h
@@ -45,8 +45,8 @@
 	char *text;
 } perrdetail;
 
-extern node *PyParser_ParseString Py_PROTO((char *, grammar *, int, perrdetail *));
-extern node *PyParser_ParseFile Py_PROTO((FILE *, char *, grammar *, int,
+extern DL_IMPORT(node *) PyParser_ParseString Py_PROTO((char *, grammar *, int, perrdetail *));
+extern DL_IMPORT(node *) PyParser_ParseFile Py_PROTO((FILE *, char *, grammar *, int,
 			    char *, char *, perrdetail *));
 
 #ifdef __cplusplus
diff --git a/Include/pgenheaders.h b/Include/pgenheaders.h
index ecfa89b..3148391 100644
--- a/Include/pgenheaders.h
+++ b/Include/pgenheaders.h
@@ -62,12 +62,12 @@
 #include "pydebug.h"
 
 #ifdef HAVE_STDARG_PROTOTYPES
-void PySys_WriteStdout(const char *format, ...);
-void PySys_WriteStderr(const char *format, ...);
+DL_IMPORT(void) PySys_WriteStdout(const char *format, ...);
+DL_IMPORT(void) PySys_WriteStderr(const char *format, ...);
 #else
 /* Better to have no prototypes at all for varargs functions in this case */
-void PySys_WriteStdout();
-void PySys_WriteStderr();
+DL_IMPORT(void) PySys_WriteStdout();
+DL_IMPORT(void) PySys_WriteStderr();
 #endif
 
 #define addarc _Py_addarc
diff --git a/Include/pydebug.h b/Include/pydebug.h
index d41a1e8..a848a15 100644
--- a/Include/pydebug.h
+++ b/Include/pydebug.h
@@ -44,7 +44,7 @@
 extern DL_IMPORT(int) Py_FrozenFlag;
 extern DL_IMPORT(int) Py_TabcheckFlag;
 
-void Py_FatalError	Py_PROTO((char *));
+DL_IMPORT(void) Py_FatalError	Py_PROTO((char *));
 
 #ifdef __cplusplus
 }
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index da5f302..8a8111a 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -37,18 +37,18 @@
 
 /* Error handling definitions */
 
-void PyErr_SetNone Py_PROTO((PyObject *));
-void PyErr_SetObject Py_PROTO((PyObject *, PyObject *));
-void PyErr_SetString Py_PROTO((PyObject *, const char *));
-PyObject *PyErr_Occurred Py_PROTO((void));
-void PyErr_Clear Py_PROTO((void));
-void PyErr_Fetch Py_PROTO((PyObject **, PyObject **, PyObject **));
-void PyErr_Restore Py_PROTO((PyObject *, PyObject *, PyObject *));
+DL_IMPORT(void) PyErr_SetNone Py_PROTO((PyObject *));
+DL_IMPORT(void) PyErr_SetObject Py_PROTO((PyObject *, PyObject *));
+DL_IMPORT(void) PyErr_SetString Py_PROTO((PyObject *, const char *));
+DL_IMPORT(PyObject *) PyErr_Occurred Py_PROTO((void));
+DL_IMPORT(void) PyErr_Clear Py_PROTO((void));
+DL_IMPORT(void) PyErr_Fetch Py_PROTO((PyObject **, PyObject **, PyObject **));
+DL_IMPORT(void) PyErr_Restore Py_PROTO((PyObject *, PyObject *, PyObject *));
 
 /* Error testing and normalization */
-int PyErr_GivenExceptionMatches Py_PROTO((PyObject *, PyObject *));
-int PyErr_ExceptionMatches Py_PROTO((PyObject *));
-void PyErr_NormalizeException Py_PROTO((PyObject**, PyObject**, PyObject**));
+DL_IMPORT(int) PyErr_GivenExceptionMatches Py_PROTO((PyObject *, PyObject *));
+DL_IMPORT(int) PyErr_ExceptionMatches Py_PROTO((PyObject *));
+DL_IMPORT(void) PyErr_NormalizeException Py_PROTO((PyObject**, PyObject**, PyObject**));
 
 
 /* Predefined exceptions */
@@ -86,21 +86,21 @@
 
 /* Convenience functions */
 
-extern int PyErr_BadArgument Py_PROTO((void));
-extern PyObject *PyErr_NoMemory Py_PROTO((void));
-extern PyObject *PyErr_SetFromErrno Py_PROTO((PyObject *));
-extern PyObject *PyErr_SetFromErrnoWithFilename Py_PROTO((PyObject *, char *));
-extern PyObject *PyErr_Format Py_PROTO((PyObject *, const char *, ...));
+extern DL_IMPORT(int) PyErr_BadArgument Py_PROTO((void));
+extern DL_IMPORT(PyObject *) PyErr_NoMemory Py_PROTO((void));
+extern DL_IMPORT(PyObject *) PyErr_SetFromErrno Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyErr_SetFromErrnoWithFilename Py_PROTO((PyObject *, char *));
+extern DL_IMPORT(PyObject *) PyErr_Format Py_PROTO((PyObject *, const char *, ...));
 
-extern void PyErr_BadInternalCall Py_PROTO((void));
+extern DL_IMPORT(void) PyErr_BadInternalCall Py_PROTO((void));
 
 /* Function to create a new exception */
-PyObject *PyErr_NewException Py_PROTO((char *name, PyObject *base,
+DL_IMPORT(PyObject *) PyErr_NewException Py_PROTO((char *name, PyObject *base,
 				       PyObject *dict));
 
 /* In sigcheck.c or signalmodule.c */
-extern int PyErr_CheckSignals Py_PROTO((void));
-extern void PyErr_SetInterrupt Py_PROTO((void));
+extern DL_IMPORT(int) PyErr_CheckSignals Py_PROTO((void));
+extern DL_IMPORT(void) PyErr_SetInterrupt Py_PROTO((void));
 	
 
 #ifdef __cplusplus
diff --git a/Include/pystate.h b/Include/pystate.h
index 7218cc0..8a58a39 100644
--- a/Include/pystate.h
+++ b/Include/pystate.h
@@ -89,17 +89,17 @@
 } PyThreadState;
 
 
-PyInterpreterState *PyInterpreterState_New Py_PROTO((void));
-void PyInterpreterState_Clear Py_PROTO((PyInterpreterState *));
-void PyInterpreterState_Delete Py_PROTO((PyInterpreterState *));
+DL_IMPORT(PyInterpreterState *) PyInterpreterState_New Py_PROTO((void));
+DL_IMPORT(void) PyInterpreterState_Clear Py_PROTO((PyInterpreterState *));
+DL_IMPORT(void) PyInterpreterState_Delete Py_PROTO((PyInterpreterState *));
 
-PyThreadState *PyThreadState_New Py_PROTO((PyInterpreterState *));
-void PyThreadState_Clear Py_PROTO((PyThreadState *));
-void PyThreadState_Delete Py_PROTO((PyThreadState *));
+DL_IMPORT(PyThreadState *) PyThreadState_New Py_PROTO((PyInterpreterState *));
+DL_IMPORT(void) PyThreadState_Clear Py_PROTO((PyThreadState *));
+DL_IMPORT(void) PyThreadState_Delete Py_PROTO((PyThreadState *));
 
-PyThreadState *PyThreadState_Get Py_PROTO((void));
-PyThreadState *PyThreadState_Swap Py_PROTO((PyThreadState *));
-PyObject *PyThreadState_GetDict Py_PROTO((void));
+DL_IMPORT(PyThreadState *) PyThreadState_Get Py_PROTO((void));
+DL_IMPORT(PyThreadState *) PyThreadState_Swap Py_PROTO((PyThreadState *));
+DL_IMPORT(PyObject *) PyThreadState_GetDict Py_PROTO((void));
 
 #ifdef __cplusplus
 }
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index 192c259..2c1df07 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -37,77 +37,77 @@
 
 /* Interfaces to parse and execute pieces of python code */
 
-void Py_SetProgramName Py_PROTO((char *));
-char *Py_GetProgramName Py_PROTO((void));
+DL_IMPORT(void) Py_SetProgramName Py_PROTO((char *));
+DL_IMPORT(char *) Py_GetProgramName Py_PROTO((void));
 
-void Py_SetPythonHome Py_PROTO((char *));
-char *Py_GetPythonHome Py_PROTO((void));
+DL_IMPORT(void) Py_SetPythonHome Py_PROTO((char *));
+DL_IMPORT(char *) Py_GetPythonHome Py_PROTO((void));
 
-void Py_Initialize Py_PROTO((void));
-void Py_Finalize Py_PROTO((void));
-int Py_IsInitialized Py_PROTO((void));
-PyThreadState *Py_NewInterpreter Py_PROTO((void));
-void Py_EndInterpreter Py_PROTO((PyThreadState *));
+DL_IMPORT(void) Py_Initialize Py_PROTO((void));
+DL_IMPORT(void) Py_Finalize Py_PROTO((void));
+DL_IMPORT(int) Py_IsInitialized Py_PROTO((void));
+DL_IMPORT(PyThreadState *) Py_NewInterpreter Py_PROTO((void));
+DL_IMPORT(void) Py_EndInterpreter Py_PROTO((PyThreadState *));
 
-int PyRun_AnyFile Py_PROTO((FILE *, char *));
+DL_IMPORT(int) PyRun_AnyFile Py_PROTO((FILE *, char *));
 
-int PyRun_SimpleString Py_PROTO((char *));
-int PyRun_SimpleFile Py_PROTO((FILE *, char *));
-int PyRun_InteractiveOne Py_PROTO((FILE *, char *));
-int PyRun_InteractiveLoop Py_PROTO((FILE *, char *));
+DL_IMPORT(int) PyRun_SimpleString Py_PROTO((char *));
+DL_IMPORT(int) PyRun_SimpleFile Py_PROTO((FILE *, char *));
+DL_IMPORT(int) PyRun_InteractiveOne Py_PROTO((FILE *, char *));
+DL_IMPORT(int) PyRun_InteractiveLoop Py_PROTO((FILE *, char *));
 
-struct _node *PyParser_SimpleParseString Py_PROTO((char *, int));
-struct _node *PyParser_SimpleParseFile Py_PROTO((FILE *, char *, int));
+DL_IMPORT(struct _node *) PyParser_SimpleParseString Py_PROTO((char *, int));
+DL_IMPORT(struct _node *) PyParser_SimpleParseFile Py_PROTO((FILE *, char *, int));
 
-PyObject *PyRun_String Py_PROTO((char *, int, PyObject *, PyObject *));
-PyObject *PyRun_File Py_PROTO((FILE *, char *, int, PyObject *, PyObject *));
+DL_IMPORT(PyObject *) PyRun_String Py_PROTO((char *, int, PyObject *, PyObject *));
+DL_IMPORT(PyObject *) PyRun_File Py_PROTO((FILE *, char *, int, PyObject *, PyObject *));
 
-PyObject *Py_CompileString Py_PROTO((char *, char *, int));
+DL_IMPORT(PyObject *) Py_CompileString Py_PROTO((char *, char *, int));
 
-void PyErr_Print Py_PROTO((void));
-void PyErr_PrintEx Py_PROTO((int));
+DL_IMPORT(void) PyErr_Print Py_PROTO((void));
+DL_IMPORT(void) PyErr_PrintEx Py_PROTO((int));
 
-int Py_AtExit Py_PROTO((void (*func) Py_PROTO((void))));
+DL_IMPORT(int) Py_AtExit Py_PROTO((void (*func) Py_PROTO((void))));
 
-void Py_Exit Py_PROTO((int));
+DL_IMPORT(void) Py_Exit Py_PROTO((int));
 
-int Py_FdIsInteractive Py_PROTO((FILE *, char *));
+DL_IMPORT(int) Py_FdIsInteractive Py_PROTO((FILE *, char *));
 
 /* In getpath.c */
-char *Py_GetProgramFullPath Py_PROTO((void));
-char *Py_GetPrefix Py_PROTO((void));
-char *Py_GetExecPrefix Py_PROTO((void));
-char *Py_GetPath Py_PROTO((void));
+DL_IMPORT(char *) Py_GetProgramFullPath Py_PROTO((void));
+DL_IMPORT(char *) Py_GetPrefix Py_PROTO((void));
+DL_IMPORT(char *) Py_GetExecPrefix Py_PROTO((void));
+DL_IMPORT(char *) Py_GetPath Py_PROTO((void));
 
 /* In their own files */
-const char *Py_GetVersion Py_PROTO((void));
-const char *Py_GetPlatform Py_PROTO((void));
-const char *Py_GetCopyright Py_PROTO((void));
-const char *Py_GetCompiler Py_PROTO((void));
-const char *Py_GetBuildInfo Py_PROTO((void));
+DL_IMPORT(const char *) Py_GetVersion Py_PROTO((void));
+DL_IMPORT(const char *) Py_GetPlatform Py_PROTO((void));
+DL_IMPORT(const char *) Py_GetCopyright Py_PROTO((void));
+DL_IMPORT(const char *) Py_GetCompiler Py_PROTO((void));
+DL_IMPORT(const char *) Py_GetBuildInfo Py_PROTO((void));
 
 /* Internal -- various one-time initializations */
 
-PyObject *_PyBuiltin_Init_1 Py_PROTO((void));
-void _PyBuiltin_Init_2 Py_PROTO((PyObject *));
-PyObject *_PySys_Init Py_PROTO((void));
-void _PyImport_Init Py_PROTO((void));
+DL_IMPORT(PyObject *) _PyBuiltin_Init_1 Py_PROTO((void));
+DL_IMPORT(void) _PyBuiltin_Init_2 Py_PROTO((PyObject *));
+DL_IMPORT(PyObject *) _PySys_Init Py_PROTO((void));
+DL_IMPORT(void) _PyImport_Init Py_PROTO((void));
 
 /* Various internal finalizers */
-void _PyImport_Fini Py_PROTO((void));
-void _PyBuiltin_Fini_1 Py_PROTO((void));
-void _PyBuiltin_Fini_2 Py_PROTO((void));
-void PyMethod_Fini Py_PROTO((void));
-void PyFrame_Fini Py_PROTO((void));
-void PyCFunction_Fini Py_PROTO((void));
-void PyTuple_Fini Py_PROTO((void));
-void PyString_Fini Py_PROTO((void));
-void PyInt_Fini Py_PROTO((void));
-void PyFloat_Fini Py_PROTO((void));
-void PyOS_FiniInterrupts Py_PROTO((void));
+DL_IMPORT(void) _PyImport_Fini Py_PROTO((void));
+DL_IMPORT(void) _PyBuiltin_Fini_1 Py_PROTO((void));
+DL_IMPORT(void) _PyBuiltin_Fini_2 Py_PROTO((void));
+DL_IMPORT(void) PyMethod_Fini Py_PROTO((void));
+DL_IMPORT(void) PyFrame_Fini Py_PROTO((void));
+DL_IMPORT(void) PyCFunction_Fini Py_PROTO((void));
+DL_IMPORT(void) PyTuple_Fini Py_PROTO((void));
+DL_IMPORT(void) PyString_Fini Py_PROTO((void));
+DL_IMPORT(void) PyInt_Fini Py_PROTO((void));
+DL_IMPORT(void) PyFloat_Fini Py_PROTO((void));
+DL_IMPORT(void) PyOS_FiniInterrupts Py_PROTO((void));
 
 /* Stuff with no proper home (yet) */
-char *PyOS_Readline Py_PROTO((char *));
+DL_IMPORT(char *) PyOS_Readline Py_PROTO((char *));
 extern DL_IMPORT(int) (*PyOS_InputHook) Py_PROTO((void));
 extern DL_IMPORT(char) *(*PyOS_ReadlineFunctionPointer) Py_PROTO((char *));
 
diff --git a/Include/pythread.h b/Include/pythread.h
index d38c174..9a2842c 100644
--- a/Include/pythread.h
+++ b/Include/pythread.h
@@ -48,40 +48,40 @@
 #define set_key_value PyThread_set_key_value
 
 
-void init_thread Py_PROTO((void));
-int start_new_thread Py_PROTO((void (*)(void *), void *));
+DL_IMPORT(void) init_thread Py_PROTO((void));
+DL_IMPORT(int) start_new_thread Py_PROTO((void (*)(void *), void *));
 #ifndef __BEOS__
-void exit_thread Py_PROTO((void));
-void _exit_thread Py_PROTO((void));
+DL_IMPORT(void) exit_thread Py_PROTO((void));
+DL_IMPORT(void) _exit_thread Py_PROTO((void));
 #else
-void PyThread_exit_thread Py_PROTO((void));
-void PyThread__exit_thread Py_PROTO((void));
+DL_IMPORT(void) PyThread_exit_thread Py_PROTO((void));
+DL_IMPORT(void) PyThread__exit_thread Py_PROTO((void));
 #endif
-long get_thread_ident Py_PROTO((void));
+DL_IMPORT(long) get_thread_ident Py_PROTO((void));
 
-type_lock allocate_lock Py_PROTO((void));
-void free_lock Py_PROTO((type_lock));
-int acquire_lock Py_PROTO((type_lock, int));
+DL_IMPORT(type_lock) allocate_lock Py_PROTO((void));
+DL_IMPORT(void) free_lock Py_PROTO((type_lock));
+DL_IMPORT(int) acquire_lock Py_PROTO((type_lock, int));
 #define WAIT_LOCK	1
 #define NOWAIT_LOCK	0
-void release_lock Py_PROTO((type_lock));
+DL_IMPORT(void) release_lock Py_PROTO((type_lock));
 
-type_sema allocate_sema Py_PROTO((int));
-void free_sema Py_PROTO((type_sema));
-int down_sema Py_PROTO((type_sema, int));
+DL_IMPORT(type_sema) allocate_sema Py_PROTO((int));
+DL_IMPORT(void) free_sema Py_PROTO((type_sema));
+DL_IMPORT(int) down_sema Py_PROTO((type_sema, int));
 #define WAIT_SEMA	1
 #define NOWAIT_SEMA	0
-void up_sema Py_PROTO((type_sema));
+DL_IMPORT(void) up_sema Py_PROTO((type_sema));
 
 #ifndef NO_EXIT_PROG
-void exit_prog Py_PROTO((int));
-void _exit_prog Py_PROTO((int));
+DL_IMPORT(void) exit_prog Py_PROTO((int));
+DL_IMPORT(void) _exit_prog Py_PROTO((int));
 #endif
 
-int create_key Py_PROTO((void));
-void delete_key Py_PROTO((int));
-int set_key_value Py_PROTO((int, void *));
-void * get_key_value Py_PROTO((int));
+DL_IMPORT(int) create_key Py_PROTO((void));
+DL_IMPORT(void) delete_key Py_PROTO((int));
+DL_IMPORT(int) set_key_value Py_PROTO((int, void *));
+DL_IMPORT(void *) get_key_value Py_PROTO((int));
 
 #ifdef __cplusplus
 }
diff --git a/Include/rangeobject.h b/Include/rangeobject.h
index 71a4e5e..a360673 100644
--- a/Include/rangeobject.h
+++ b/Include/rangeobject.h
@@ -43,4 +43,4 @@
 
 #define PyRange_Check(op) ((op)->ob_type == &PyRange_Type)
 
-extern PyObject *PyRange_New Py_PROTO((long, long, long, int));
+extern DL_IMPORT(PyObject *) PyRange_New Py_PROTO((long, long, long, int));
diff --git a/Include/sliceobject.h b/Include/sliceobject.h
index c3f83de..d38f7be 100644
--- a/Include/sliceobject.h
+++ b/Include/sliceobject.h
@@ -28,9 +28,9 @@
 
 #define PySlice_Check(op) ((op)->ob_type == &PySlice_Type)
 
-PyObject *PySlice_New Py_PROTO((
+DL_IMPORT(PyObject *) PySlice_New Py_PROTO((
 	PyObject* start, PyObject* stop, PyObject* step));
-int PySlice_GetIndices Py_PROTO((
+DL_IMPORT(int) PySlice_GetIndices Py_PROTO((
 	PySliceObject *r, int length, int *start, int *stop, int *step));
 
 #ifdef __cplusplus
diff --git a/Include/stringobject.h b/Include/stringobject.h
index 8466821..7b9b53f 100644
--- a/Include/stringobject.h
+++ b/Include/stringobject.h
@@ -81,18 +81,18 @@
 
 #define PyString_Check(op) ((op)->ob_type == &PyString_Type)
 
-extern PyObject *PyString_FromStringAndSize Py_PROTO((const char *, int));
-extern PyObject *PyString_FromString Py_PROTO((const char *));
-extern int PyString_Size Py_PROTO((PyObject *));
-extern char *PyString_AsString Py_PROTO((PyObject *));
-extern void PyString_Concat Py_PROTO((PyObject **, PyObject *));
-extern void PyString_ConcatAndDel Py_PROTO((PyObject **, PyObject *));
-extern int _PyString_Resize Py_PROTO((PyObject **, int));
-extern PyObject *PyString_Format Py_PROTO((PyObject *, PyObject *));
+extern DL_IMPORT(PyObject *) PyString_FromStringAndSize Py_PROTO((const char *, int));
+extern DL_IMPORT(PyObject *) PyString_FromString Py_PROTO((const char *));
+extern DL_IMPORT(int) PyString_Size Py_PROTO((PyObject *));
+extern DL_IMPORT(char *) PyString_AsString Py_PROTO((PyObject *));
+extern DL_IMPORT(void) PyString_Concat Py_PROTO((PyObject **, PyObject *));
+extern DL_IMPORT(void) PyString_ConcatAndDel Py_PROTO((PyObject **, PyObject *));
+extern DL_IMPORT(int) _PyString_Resize Py_PROTO((PyObject **, int));
+extern DL_IMPORT(PyObject *) PyString_Format Py_PROTO((PyObject *, PyObject *));
 
 #ifdef INTERN_STRINGS
-extern void PyString_InternInPlace Py_PROTO((PyObject **));
-extern PyObject *PyString_InternFromString Py_PROTO((const char *));
+extern DL_IMPORT(void) PyString_InternInPlace Py_PROTO((PyObject **));
+extern DL_IMPORT(PyObject *) PyString_InternFromString Py_PROTO((const char *));
 #else
 #define PyString_InternInPlace(p)
 #define PyString_InternFromString(cp) PyString_FromString(cp)
diff --git a/Include/structmember.h b/Include/structmember.h
index 9d19dff..1dd763b 100644
--- a/Include/structmember.h
+++ b/Include/structmember.h
@@ -92,8 +92,8 @@
 #define READONLY	1
 #define RO		READONLY		/* Shorthand */
 
-PyObject *PyMember_Get Py_PROTO((char *, struct memberlist *, char *));
-int PyMember_Set Py_PROTO((char *, struct memberlist *, char *, PyObject *));
+DL_IMPORT(PyObject *) PyMember_Get Py_PROTO((char *, struct memberlist *, char *));
+DL_IMPORT(int) PyMember_Set Py_PROTO((char *, struct memberlist *, char *, PyObject *));
 
 #ifdef __cplusplus
 }
diff --git a/Include/sysmodule.h b/Include/sysmodule.h
index 41e92b3..b655bc2 100644
--- a/Include/sysmodule.h
+++ b/Include/sysmodule.h
@@ -37,19 +37,19 @@
 
 /* System module interface */
 
-PyObject *PySys_GetObject Py_PROTO((char *));
-int PySys_SetObject Py_PROTO((char *, PyObject *));
-FILE *PySys_GetFile Py_PROTO((char *, FILE *));
-void PySys_SetArgv Py_PROTO((int, char **));
-void PySys_SetPath Py_PROTO((char *));
+DL_IMPORT(PyObject *) PySys_GetObject Py_PROTO((char *));
+DL_IMPORT(int) PySys_SetObject Py_PROTO((char *, PyObject *));
+DL_IMPORT(FILE *) PySys_GetFile Py_PROTO((char *, FILE *));
+DL_IMPORT(void) PySys_SetArgv Py_PROTO((int, char **));
+DL_IMPORT(void) PySys_SetPath Py_PROTO((char *));
 
 #ifdef HAVE_STDARG_PROTOTYPES
-void PySys_WriteStdout(const char *format, ...);
-void PySys_WriteStderr(const char *format, ...);
+DL_IMPORT(void) PySys_WriteStdout(const char *format, ...);
+DL_IMPORT(void) PySys_WriteStderr(const char *format, ...);
 #else
 /* Better to have no prototypes at all for varargs functions in this case */
-void PySys_WriteStdout();
-void PySys_WriteStderr();
+DL_IMPORT(void) PySys_WriteStdout();
+DL_IMPORT(void) PySys_WriteStderr();
 #endif
 
 extern DL_IMPORT(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc;
diff --git a/Include/token.h b/Include/token.h
index fefe030..3b4e2ee 100644
--- a/Include/token.h
+++ b/Include/token.h
@@ -88,9 +88,9 @@
 #define ISEOF(x)		((x) == ENDMARKER)
 
 
-extern char *_PyParser_TokenNames[]; /* Token names */
-extern int PyToken_OneChar Py_PROTO((int));
-extern int PyToken_TwoChars Py_PROTO((int, int));
+extern DL_IMPORT(char *) _PyParser_TokenNames[]; /* Token names */
+extern DL_IMPORT(int) PyToken_OneChar Py_PROTO((int));
+extern DL_IMPORT(int) PyToken_TwoChars Py_PROTO((int, int));
 
 #ifdef __cplusplus
 }
diff --git a/Include/traceback.h b/Include/traceback.h
index 1551d7c..57bdb34 100644
--- a/Include/traceback.h
+++ b/Include/traceback.h
@@ -39,13 +39,13 @@
 
 struct _frame;
 
-int PyTraceBack_Here Py_PROTO((struct _frame *));
-PyObject *PyTraceBack_Fetch Py_PROTO((void));
-int PyTraceBack_Store Py_PROTO((PyObject *));
-int PyTraceBack_Print Py_PROTO((PyObject *, PyObject *));
+DL_IMPORT(int) PyTraceBack_Here Py_PROTO((struct _frame *));
+DL_IMPORT(PyObject *) PyTraceBack_Fetch Py_PROTO((void));
+DL_IMPORT(int) PyTraceBack_Store Py_PROTO((PyObject *));
+DL_IMPORT(int) PyTraceBack_Print Py_PROTO((PyObject *, PyObject *));
 
 /* Reveale traceback type so we can typecheck traceback objects */
-extern PyTypeObject PyTraceBack_Type;
+extern DL_IMPORT(PyTypeObject) PyTraceBack_Type;
 #define PyTraceBack_Check(v) ((v)->ob_type == &PyTraceBack_Type)
 
 #ifdef __cplusplus
diff --git a/Include/tupleobject.h b/Include/tupleobject.h
index 506f965..31983d5 100644
--- a/Include/tupleobject.h
+++ b/Include/tupleobject.h
@@ -60,12 +60,12 @@
 
 #define PyTuple_Check(op) ((op)->ob_type == &PyTuple_Type)
 
-extern PyObject *PyTuple_New Py_PROTO((int size));
-extern int PyTuple_Size Py_PROTO((PyObject *));
-extern PyObject *PyTuple_GetItem Py_PROTO((PyObject *, int));
-extern int PyTuple_SetItem Py_PROTO((PyObject *, int, PyObject *));
-extern PyObject *PyTuple_GetSlice Py_PROTO((PyObject *, int, int));
-extern int _PyTuple_Resize Py_PROTO((PyObject **, int, int));
+extern DL_IMPORT(PyObject *) PyTuple_New Py_PROTO((int size));
+extern DL_IMPORT(int) PyTuple_Size Py_PROTO((PyObject *));
+extern DL_IMPORT(PyObject *) PyTuple_GetItem Py_PROTO((PyObject *, int));
+extern DL_IMPORT(int) PyTuple_SetItem Py_PROTO((PyObject *, int, PyObject *));
+extern DL_IMPORT(PyObject *) PyTuple_GetSlice Py_PROTO((PyObject *, int, int));
+extern DL_IMPORT(int) _PyTuple_Resize Py_PROTO((PyObject **, int, int));
 
 /* Macro, trading safety for speed */
 #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i])