Index: generic/tclOO.decls
===================================================================
--- generic/tclOO.decls
+++ generic/tclOO.decls
@@ -2,10 +2,11 @@
 
 # public API
 library tclOO
 interface tclOO
 hooks tclOOInt
+scspec TCLOOAPI
 
 declare 0 generic {
     Tcl_Object Tcl_CopyObjectInstance(Tcl_Interp *interp,
 	    Tcl_Object sourceObject, const char *targetName,
 	    const char *targetNamespaceName)

Index: generic/tclOO.h
===================================================================
--- generic/tclOO.h
+++ generic/tclOO.h
@@ -12,23 +12,23 @@
 
 #ifndef TCLOO_H_INCLUDED
 #define TCLOO_H_INCLUDED
 #include "tcl.h"
 
-#undef TCL_STORAGE_CLASS
-#ifdef BUILD_TclOO /* Match PACKAGE_NAME case sensitive */
-#   define TCL_STORAGE_CLASS DLLEXPORT
-#	define TCLOOAPI DLLEXPORT
+#ifndef TCLOOAPI
+#   if defined(BUILD_tcl) || defined(BUILD_TclOO)
+#	define TCLOOAPI MODULE_SCOPE
+#   else
+#	define TCLOOAPI extern
 #	undef USE_TCLOO_STUBS
-#else
-#	define TCLOOAPI DLLIMPORT
-#   ifdef USE_TCLOO_STUBS
-#	define TCL_STORAGE_CLASS
-#   else
-#	define TCL_STORAGE_CLASS DLLIMPORT
+#	define USE_TCLOO_STUBS 1
 #   endif
 #endif
+
+extern const char *TclOOInitializeStubs(
+	Tcl_Interp *, const char *version, int exact);
+#define Tcl_OOInitStubs(interp) TclOOInitializeStubs((interp), TCLOO_VERSION, 0)
 
 /*
  * Must match version at top of ../configure.in
  */
 

Index: generic/tclOODecls.h
===================================================================
--- generic/tclOODecls.h
+++ generic/tclOODecls.h
@@ -1,196 +1,188 @@
 /*
  * This file is (mostly) automatically generated from tclOO.decls.
  */
 
-#if defined(USE_TCLOO_STUBS)
-extern const char *TclOOInitializeStubs(
-	Tcl_Interp *, const char *version, int exact);
-#define Tcl_OOInitStubs(interp) TclOOInitializeStubs(interp, TCLOO_VERSION, 0)
-#else
-#define Tcl_OOInitStubs(interp) Tcl_PkgRequire(interp, "TclOO", TCLOO_VERSION, 0)
-#endif
-
 /* !BEGIN!: Do not edit below this line. */
 
 /*
  * Exported function declarations:
  */
 
 #ifndef Tcl_CopyObjectInstance_TCL_DECLARED
 #define Tcl_CopyObjectInstance_TCL_DECLARED
 /* 0 */
-EXTERN Tcl_Object	Tcl_CopyObjectInstance(Tcl_Interp *interp,
+TCLOOAPI Tcl_Object	Tcl_CopyObjectInstance(Tcl_Interp *interp,
 				Tcl_Object sourceObject,
 				const char *targetName,
 				const char *targetNamespaceName);
 #endif
 #ifndef Tcl_GetClassAsObject_TCL_DECLARED
 #define Tcl_GetClassAsObject_TCL_DECLARED
 /* 1 */
-EXTERN Tcl_Object	Tcl_GetClassAsObject(Tcl_Class clazz);
+TCLOOAPI Tcl_Object	Tcl_GetClassAsObject(Tcl_Class clazz);
 #endif
 #ifndef Tcl_GetObjectAsClass_TCL_DECLARED
 #define Tcl_GetObjectAsClass_TCL_DECLARED
 /* 2 */
-EXTERN Tcl_Class	Tcl_GetObjectAsClass(Tcl_Object object);
+TCLOOAPI Tcl_Class	Tcl_GetObjectAsClass(Tcl_Object object);
 #endif
 #ifndef Tcl_GetObjectCommand_TCL_DECLARED
 #define Tcl_GetObjectCommand_TCL_DECLARED
 /* 3 */
-EXTERN Tcl_Command	Tcl_GetObjectCommand(Tcl_Object object);
+TCLOOAPI Tcl_Command	Tcl_GetObjectCommand(Tcl_Object object);
 #endif
 #ifndef Tcl_GetObjectFromObj_TCL_DECLARED
 #define Tcl_GetObjectFromObj_TCL_DECLARED
 /* 4 */
-EXTERN Tcl_Object	Tcl_GetObjectFromObj(Tcl_Interp *interp,
+TCLOOAPI Tcl_Object	Tcl_GetObjectFromObj(Tcl_Interp *interp,
 				Tcl_Obj *objPtr);
 #endif
 #ifndef Tcl_GetObjectNamespace_TCL_DECLARED
 #define Tcl_GetObjectNamespace_TCL_DECLARED
 /* 5 */
-EXTERN Tcl_Namespace *	Tcl_GetObjectNamespace(Tcl_Object object);
+TCLOOAPI Tcl_Namespace *	Tcl_GetObjectNamespace(Tcl_Object object);
 #endif
 #ifndef Tcl_MethodDeclarerClass_TCL_DECLARED
 #define Tcl_MethodDeclarerClass_TCL_DECLARED
 /* 6 */
-EXTERN Tcl_Class	Tcl_MethodDeclarerClass(Tcl_Method method);
+TCLOOAPI Tcl_Class	Tcl_MethodDeclarerClass(Tcl_Method method);
 #endif
 #ifndef Tcl_MethodDeclarerObject_TCL_DECLARED
 #define Tcl_MethodDeclarerObject_TCL_DECLARED
 /* 7 */
-EXTERN Tcl_Object	Tcl_MethodDeclarerObject(Tcl_Method method);
+TCLOOAPI Tcl_Object	Tcl_MethodDeclarerObject(Tcl_Method method);
 #endif
 #ifndef Tcl_MethodIsPublic_TCL_DECLARED
 #define Tcl_MethodIsPublic_TCL_DECLARED
 /* 8 */
-EXTERN int		Tcl_MethodIsPublic(Tcl_Method method);
+TCLOOAPI int		Tcl_MethodIsPublic(Tcl_Method method);
 #endif
 #ifndef Tcl_MethodIsType_TCL_DECLARED
 #define Tcl_MethodIsType_TCL_DECLARED
 /* 9 */
-EXTERN int		Tcl_MethodIsType(Tcl_Method method,
+TCLOOAPI int		Tcl_MethodIsType(Tcl_Method method,
 				const Tcl_MethodType *typePtr,
 				ClientData *clientDataPtr);
 #endif
 #ifndef Tcl_MethodName_TCL_DECLARED
 #define Tcl_MethodName_TCL_DECLARED
 /* 10 */
-EXTERN Tcl_Obj *	Tcl_MethodName(Tcl_Method method);
+TCLOOAPI Tcl_Obj *	Tcl_MethodName(Tcl_Method method);
 #endif
 #ifndef Tcl_NewInstanceMethod_TCL_DECLARED
 #define Tcl_NewInstanceMethod_TCL_DECLARED
 /* 11 */
-EXTERN Tcl_Method	Tcl_NewInstanceMethod(Tcl_Interp *interp,
+TCLOOAPI Tcl_Method	Tcl_NewInstanceMethod(Tcl_Interp *interp,
 				Tcl_Object object, Tcl_Obj *nameObj,
 				int isPublic, const Tcl_MethodType *typePtr,
 				ClientData clientData);
 #endif
 #ifndef Tcl_NewMethod_TCL_DECLARED
 #define Tcl_NewMethod_TCL_DECLARED
 /* 12 */
-EXTERN Tcl_Method	Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls,
+TCLOOAPI Tcl_Method	Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls,
 				Tcl_Obj *nameObj, int isPublic,
 				const Tcl_MethodType *typePtr,
 				ClientData clientData);
 #endif
 #ifndef Tcl_NewObjectInstance_TCL_DECLARED
 #define Tcl_NewObjectInstance_TCL_DECLARED
 /* 13 */
-EXTERN Tcl_Object	Tcl_NewObjectInstance(Tcl_Interp *interp,
+TCLOOAPI Tcl_Object	Tcl_NewObjectInstance(Tcl_Interp *interp,
 				Tcl_Class cls, const char *nameStr,
 				const char *nsNameStr, int objc,
 				Tcl_Obj *const *objv, int skip);
 #endif
 #ifndef Tcl_ObjectDeleted_TCL_DECLARED
 #define Tcl_ObjectDeleted_TCL_DECLARED
 /* 14 */
-EXTERN int		Tcl_ObjectDeleted(Tcl_Object object);
+TCLOOAPI int		Tcl_ObjectDeleted(Tcl_Object object);
 #endif
 #ifndef Tcl_ObjectContextIsFiltering_TCL_DECLARED
 #define Tcl_ObjectContextIsFiltering_TCL_DECLARED
 /* 15 */
-EXTERN int		Tcl_ObjectContextIsFiltering(
+TCLOOAPI int		Tcl_ObjectContextIsFiltering(
 				Tcl_ObjectContext context);
 #endif
 #ifndef Tcl_ObjectContextMethod_TCL_DECLARED
 #define Tcl_ObjectContextMethod_TCL_DECLARED
 /* 16 */
-EXTERN Tcl_Method	Tcl_ObjectContextMethod(Tcl_ObjectContext context);
+TCLOOAPI Tcl_Method	Tcl_ObjectContextMethod(Tcl_ObjectContext context);
 #endif
 #ifndef Tcl_ObjectContextObject_TCL_DECLARED
 #define Tcl_ObjectContextObject_TCL_DECLARED
 /* 17 */
-EXTERN Tcl_Object	Tcl_ObjectContextObject(Tcl_ObjectContext context);
+TCLOOAPI Tcl_Object	Tcl_ObjectContextObject(Tcl_ObjectContext context);
 #endif
 #ifndef Tcl_ObjectContextSkippedArgs_TCL_DECLARED
 #define Tcl_ObjectContextSkippedArgs_TCL_DECLARED
 /* 18 */
-EXTERN int		Tcl_ObjectContextSkippedArgs(
+TCLOOAPI int		Tcl_ObjectContextSkippedArgs(
 				Tcl_ObjectContext context);
 #endif
 #ifndef Tcl_ClassGetMetadata_TCL_DECLARED
 #define Tcl_ClassGetMetadata_TCL_DECLARED
 /* 19 */
-EXTERN ClientData	Tcl_ClassGetMetadata(Tcl_Class clazz,
+TCLOOAPI ClientData	Tcl_ClassGetMetadata(Tcl_Class clazz,
 				const Tcl_ObjectMetadataType *typePtr);
 #endif
 #ifndef Tcl_ClassSetMetadata_TCL_DECLARED
 #define Tcl_ClassSetMetadata_TCL_DECLARED
 /* 20 */
-EXTERN void		Tcl_ClassSetMetadata(Tcl_Class clazz,
+TCLOOAPI void		Tcl_ClassSetMetadata(Tcl_Class clazz,
 				const Tcl_ObjectMetadataType *typePtr,
 				ClientData metadata);
 #endif
 #ifndef Tcl_ObjectGetMetadata_TCL_DECLARED
 #define Tcl_ObjectGetMetadata_TCL_DECLARED
 /* 21 */
-EXTERN ClientData	Tcl_ObjectGetMetadata(Tcl_Object object,
+TCLOOAPI ClientData	Tcl_ObjectGetMetadata(Tcl_Object object,
 				const Tcl_ObjectMetadataType *typePtr);
 #endif
 #ifndef Tcl_ObjectSetMetadata_TCL_DECLARED
 #define Tcl_ObjectSetMetadata_TCL_DECLARED
 /* 22 */
-EXTERN void		Tcl_ObjectSetMetadata(Tcl_Object object,
+TCLOOAPI void		Tcl_ObjectSetMetadata(Tcl_Object object,
 				const Tcl_ObjectMetadataType *typePtr,
 				ClientData metadata);
 #endif
 #ifndef Tcl_ObjectContextInvokeNext_TCL_DECLARED
 #define Tcl_ObjectContextInvokeNext_TCL_DECLARED
 /* 23 */
-EXTERN int		Tcl_ObjectContextInvokeNext(Tcl_Interp *interp,
+TCLOOAPI int		Tcl_ObjectContextInvokeNext(Tcl_Interp *interp,
 				Tcl_ObjectContext context, int objc,
 				Tcl_Obj *const *objv, int skip);
 #endif
 #ifndef Tcl_ObjectGetMethodNameMapper_TCL_DECLARED
 #define Tcl_ObjectGetMethodNameMapper_TCL_DECLARED
 /* 24 */
-EXTERN Tcl_ObjectMapMethodNameProc * Tcl_ObjectGetMethodNameMapper(
+TCLOOAPI Tcl_ObjectMapMethodNameProc * Tcl_ObjectGetMethodNameMapper(
 				Tcl_Object object);
 #endif
 #ifndef Tcl_ObjectSetMethodNameMapper_TCL_DECLARED
 #define Tcl_ObjectSetMethodNameMapper_TCL_DECLARED
 /* 25 */
-EXTERN void		Tcl_ObjectSetMethodNameMapper(Tcl_Object object,
+TCLOOAPI void		Tcl_ObjectSetMethodNameMapper(Tcl_Object object,
 				Tcl_ObjectMapMethodNameProc *mapMethodNameProc);
 #endif
 #ifndef Tcl_ClassSetConstructor_TCL_DECLARED
 #define Tcl_ClassSetConstructor_TCL_DECLARED
 /* 26 */
-EXTERN void		Tcl_ClassSetConstructor(Tcl_Interp *interp,
+TCLOOAPI void		Tcl_ClassSetConstructor(Tcl_Interp *interp,
 				Tcl_Class clazz, Tcl_Method method);
 #endif
 #ifndef Tcl_ClassSetDestructor_TCL_DECLARED
 #define Tcl_ClassSetDestructor_TCL_DECLARED
 /* 27 */
-EXTERN void		Tcl_ClassSetDestructor(Tcl_Interp *interp,
+TCLOOAPI void		Tcl_ClassSetDestructor(Tcl_Interp *interp,
 				Tcl_Class clazz, Tcl_Method method);
 #endif
 #ifndef Tcl_GetObjectName_TCL_DECLARED
 #define Tcl_GetObjectName_TCL_DECLARED
 /* 28 */
-EXTERN Tcl_Obj *	Tcl_GetObjectName(Tcl_Interp *interp,
+TCLOOAPI Tcl_Obj *	Tcl_GetObjectName(Tcl_Interp *interp,
 				Tcl_Object object);
 #endif
 
 typedef struct TclOOStubHooks {
     const struct TclOOIntStubs *tclOOIntStubs;

Index: generic/tclOOIntDecls.h
===================================================================
--- generic/tclOOIntDecls.h
+++ generic/tclOOIntDecls.h
@@ -9,77 +9,77 @@
  */
 
 #ifndef TclOOGetDefineCmdContext_TCL_DECLARED
 #define TclOOGetDefineCmdContext_TCL_DECLARED
 /* 0 */
-EXTERN Tcl_Object	TclOOGetDefineCmdContext(Tcl_Interp *interp);
+TCLOOAPI Tcl_Object	TclOOGetDefineCmdContext(Tcl_Interp *interp);
 #endif
 #ifndef TclOOMakeProcInstanceMethod_TCL_DECLARED
 #define TclOOMakeProcInstanceMethod_TCL_DECLARED
 /* 1 */
-EXTERN Tcl_Method	TclOOMakeProcInstanceMethod(Tcl_Interp *interp,
+TCLOOAPI Tcl_Method	TclOOMakeProcInstanceMethod(Tcl_Interp *interp,
 				Object *oPtr, int flags, Tcl_Obj *nameObj,
 				Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
 				const Tcl_MethodType *typePtr,
 				ClientData clientData, Proc **procPtrPtr);
 #endif
 #ifndef TclOOMakeProcMethod_TCL_DECLARED
 #define TclOOMakeProcMethod_TCL_DECLARED
 /* 2 */
-EXTERN Tcl_Method	TclOOMakeProcMethod(Tcl_Interp *interp,
+TCLOOAPI Tcl_Method	TclOOMakeProcMethod(Tcl_Interp *interp,
 				Class *clsPtr, int flags, Tcl_Obj *nameObj,
 				const char *namePtr, Tcl_Obj *argsObj,
 				Tcl_Obj *bodyObj,
 				const Tcl_MethodType *typePtr,
 				ClientData clientData, Proc **procPtrPtr);
 #endif
 #ifndef TclOONewProcInstanceMethod_TCL_DECLARED
 #define TclOONewProcInstanceMethod_TCL_DECLARED
 /* 3 */
-EXTERN Method *		TclOONewProcInstanceMethod(Tcl_Interp *interp,
+TCLOOAPI Method *		TclOONewProcInstanceMethod(Tcl_Interp *interp,
 				Object *oPtr, int flags, Tcl_Obj *nameObj,
 				Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
 				ProcedureMethod **pmPtrPtr);
 #endif
 #ifndef TclOONewProcMethod_TCL_DECLARED
 #define TclOONewProcMethod_TCL_DECLARED
 /* 4 */
-EXTERN Method *		TclOONewProcMethod(Tcl_Interp *interp, Class *clsPtr,
+TCLOOAPI Method *		TclOONewProcMethod(Tcl_Interp *interp, Class *clsPtr,
 				int flags, Tcl_Obj *nameObj,
 				Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
 				ProcedureMethod **pmPtrPtr);
 #endif
 #ifndef TclOOObjectCmdCore_TCL_DECLARED
 #define TclOOObjectCmdCore_TCL_DECLARED
 /* 5 */
-EXTERN int		TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp,
+TCLOOAPI int		TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp,
 				int objc, Tcl_Obj *const *objv,
 				int publicOnly, Class *startCls);
 #endif
 #ifndef TclOOIsReachable_TCL_DECLARED
 #define TclOOIsReachable_TCL_DECLARED
 /* 6 */
-EXTERN int		TclOOIsReachable(Class *targetPtr, Class *startPtr);
+TCLOOAPI int		TclOOIsReachable(Class *targetPtr, Class *startPtr);
 #endif
 #ifndef TclOONewForwardMethod_TCL_DECLARED
 #define TclOONewForwardMethod_TCL_DECLARED
 /* 7 */
-EXTERN Method *		TclOONewForwardMethod(Tcl_Interp *interp,
+TCLOOAPI Method *		TclOONewForwardMethod(Tcl_Interp *interp,
 				Class *clsPtr, int isPublic,
 				Tcl_Obj *nameObj, Tcl_Obj *prefixObj);
 #endif
 #ifndef TclOONewForwardInstanceMethod_TCL_DECLARED
 #define TclOONewForwardInstanceMethod_TCL_DECLARED
 /* 8 */
-EXTERN Method *		TclOONewForwardInstanceMethod(Tcl_Interp *interp,
+TCLOOAPI Method *		TclOONewForwardInstanceMethod(Tcl_Interp *interp,
 				Object *oPtr, int isPublic, Tcl_Obj *nameObj,
 				Tcl_Obj *prefixObj);
 #endif
 #ifndef TclOONewProcInstanceMethodEx_TCL_DECLARED
 #define TclOONewProcInstanceMethodEx_TCL_DECLARED
 /* 9 */
-EXTERN Tcl_Method	TclOONewProcInstanceMethodEx(Tcl_Interp *interp,
+TCLOOAPI Tcl_Method	TclOONewProcInstanceMethodEx(Tcl_Interp *interp,
 				Tcl_Object oPtr,
 				TclOO_PreCallProc *preCallPtr,
 				TclOO_PostCallProc *postCallPtr,
 				ProcErrorProc errProc, ClientData clientData,
 				Tcl_Obj *nameObj, Tcl_Obj *argsObj,
@@ -87,11 +87,11 @@
 				void **internalTokenPtr);
 #endif
 #ifndef TclOONewProcMethodEx_TCL_DECLARED
 #define TclOONewProcMethodEx_TCL_DECLARED
 /* 10 */
-EXTERN Tcl_Method	TclOONewProcMethodEx(Tcl_Interp *interp,
+TCLOOAPI Tcl_Method	TclOONewProcMethodEx(Tcl_Interp *interp,
 				Tcl_Class clsPtr,
 				TclOO_PreCallProc *preCallPtr,
 				TclOO_PostCallProc *postCallPtr,
 				ProcErrorProc errProc, ClientData clientData,
 				Tcl_Obj *nameObj, Tcl_Obj *argsObj,
@@ -99,38 +99,38 @@
 				void **internalTokenPtr);
 #endif
 #ifndef TclOOInvokeObject_TCL_DECLARED
 #define TclOOInvokeObject_TCL_DECLARED
 /* 11 */
-EXTERN int		TclOOInvokeObject(Tcl_Interp *interp,
+TCLOOAPI int		TclOOInvokeObject(Tcl_Interp *interp,
 				Tcl_Object object, Tcl_Class startCls,
 				int publicPrivate, int objc,
 				Tcl_Obj *const *objv);
 #endif
 #ifndef TclOOObjectSetFilters_TCL_DECLARED
 #define TclOOObjectSetFilters_TCL_DECLARED
 /* 12 */
-EXTERN void		TclOOObjectSetFilters(Object *oPtr, int numFilters,
+TCLOOAPI void		TclOOObjectSetFilters(Object *oPtr, int numFilters,
 				Tcl_Obj *const *filters);
 #endif
 #ifndef TclOOClassSetFilters_TCL_DECLARED
 #define TclOOClassSetFilters_TCL_DECLARED
 /* 13 */
-EXTERN void		TclOOClassSetFilters(Tcl_Interp *interp,
+TCLOOAPI void		TclOOClassSetFilters(Tcl_Interp *interp,
 				Class *classPtr, int numFilters,
 				Tcl_Obj *const *filters);
 #endif
 #ifndef TclOOObjectSetMixins_TCL_DECLARED
 #define TclOOObjectSetMixins_TCL_DECLARED
 /* 14 */
-EXTERN void		TclOOObjectSetMixins(Object *oPtr, int numMixins,
+TCLOOAPI void		TclOOObjectSetMixins(Object *oPtr, int numMixins,
 				Class *const *mixins);
 #endif
 #ifndef TclOOClassSetMixins_TCL_DECLARED
 #define TclOOClassSetMixins_TCL_DECLARED
 /* 15 */
-EXTERN void		TclOOClassSetMixins(Tcl_Interp *interp,
+TCLOOAPI void		TclOOClassSetMixins(Tcl_Interp *interp,
 				Class *classPtr, int numMixins,
 				Class *const *mixins);
 #endif
 
 typedef struct TclOOIntStubs {

