Subject: Fix TclOO API export rules.

From: dkf <[email-masked]>
Date: Wed, 2 Oct 2013 09:41:01 +0000

---
 generic/tclOO.decls     |  1 -
 generic/tclOO.h         | 33 ++++++++++++-----------
 generic/tclOODecls.h    | 72 +++++++++++++++++++++++++++++--------------------
 generic/tclOOIntDecls.h | 46 ++++++++++++++++++++-----------
 4 files changed, 91 insertions(+), 61 deletions(-)

diff --git a/generic/tclOO.decls b/generic/tclOO.decls
index f22390e..4f1987c 100644
--- a/generic/tclOO.decls
+++ b/generic/tclOO.decls
@@ -12,7 +12,6 @@
 # this file, and for a DISCLAIMER OF ALL WARRANTIES.
 
 library tclOO
-scspec TCLOOAPI
 
 ######################################################################
 # Public API, exposed for general users of TclOO.
diff --git a/generic/tclOO.h b/generic/tclOO.h
index d5ab8a0..4a6cda7 100644
--- a/generic/tclOO.h
+++ b/generic/tclOO.h
@@ -12,21 +12,6 @@
 
 #ifndef TCLOO_H_INCLUDED
 #define TCLOO_H_INCLUDED
-#include "tcl.h"
-
-#ifndef TCLOOAPI
-#   if defined(BUILD_tcl) || defined(BUILD_TclOO)
-#	define TCLOOAPI MODULE_SCOPE
-#   else
-#	define TCLOOAPI extern
-#	undef USE_TCLOO_STUBS
-#	define USE_TCLOO_STUBS 1
-#   endif
-#endif
-
-extern const char *TclOOInitializeStubs(
-	Tcl_Interp *, const char *version);
-#define Tcl_OOInitStubs(interp) TclOOInitializeStubs((interp), TCLOO_VERSION)
 
 /*
  * Be careful when it comes to versioning; need to make sure that the
@@ -42,6 +27,21 @@ extern const char *TclOOInitializeStubs(
 #define TCLOO_VERSION "1.0.1"
 #define TCLOO_PATCHLEVEL TCLOO_VERSION
 
+#include "tcl.h"
+
+/*
+ * For C++ compilers, use extern "C"
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const char *TclOOInitializeStubs(
+	Tcl_Interp *, const char *version);
+#define Tcl_OOInitStubs(interp) \
+    TclOOInitializeStubs((interp), TCLOO_VERSION)
+
 /*
  * These are opaque types.
  */
@@ -130,6 +130,9 @@ typedef struct {
 
 #include "tclOODecls.h"
 
+#ifdef __cplusplus
+}
+#endif
 #endif
 
 /*
diff --git a/generic/tclOODecls.h b/generic/tclOODecls.h
index 58871c6..c2a5615 100644
--- a/generic/tclOODecls.h
+++ b/generic/tclOODecls.h
@@ -5,6 +5,17 @@
 #ifndef _TCLOODECLS
 #define _TCLOODECLS
 
+#undef TCL_STORAGE_CLASS
+#ifdef BUILD_tcl
+#   define TCL_STORAGE_CLASS DLLEXPORT
+#else
+#   ifdef USE_TCL_STUBS
+#      define TCL_STORAGE_CLASS
+#   else
+#      define TCL_STORAGE_CLASS DLLIMPORT
+#   endif
+#endif
+
 /* !BEGIN!: Do not edit below this line. */
 
 /*
@@ -12,92 +23,92 @@
  */
 
 /* 0 */
-TCLOOAPI Tcl_Object	Tcl_CopyObjectInstance(Tcl_Interp *interp,
+EXTERN Tcl_Object	Tcl_CopyObjectInstance(Tcl_Interp *interp,
 				Tcl_Object sourceObject,
 				const char *targetName,
 				const char *targetNamespaceName);
 /* 1 */
-TCLOOAPI Tcl_Object	Tcl_GetClassAsObject(Tcl_Class clazz);
+EXTERN Tcl_Object	Tcl_GetClassAsObject(Tcl_Class clazz);
 /* 2 */
-TCLOOAPI Tcl_Class	Tcl_GetObjectAsClass(Tcl_Object object);
+EXTERN Tcl_Class	Tcl_GetObjectAsClass(Tcl_Object object);
 /* 3 */
-TCLOOAPI Tcl_Command	Tcl_GetObjectCommand(Tcl_Object object);
+EXTERN Tcl_Command	Tcl_GetObjectCommand(Tcl_Object object);
 /* 4 */
-TCLOOAPI Tcl_Object	Tcl_GetObjectFromObj(Tcl_Interp *interp,
+EXTERN Tcl_Object	Tcl_GetObjectFromObj(Tcl_Interp *interp,
 				Tcl_Obj *objPtr);
 /* 5 */
-TCLOOAPI Tcl_Namespace * Tcl_GetObjectNamespace(Tcl_Object object);
+EXTERN Tcl_Namespace *	Tcl_GetObjectNamespace(Tcl_Object object);
 /* 6 */
-TCLOOAPI Tcl_Class	Tcl_MethodDeclarerClass(Tcl_Method method);
+EXTERN Tcl_Class	Tcl_MethodDeclarerClass(Tcl_Method method);
 /* 7 */
-TCLOOAPI Tcl_Object	Tcl_MethodDeclarerObject(Tcl_Method method);
+EXTERN Tcl_Object	Tcl_MethodDeclarerObject(Tcl_Method method);
 /* 8 */
-TCLOOAPI int		Tcl_MethodIsPublic(Tcl_Method method);
+EXTERN int		Tcl_MethodIsPublic(Tcl_Method method);
 /* 9 */
-TCLOOAPI int		Tcl_MethodIsType(Tcl_Method method,
+EXTERN int		Tcl_MethodIsType(Tcl_Method method,
 				const Tcl_MethodType *typePtr,
 				ClientData *clientDataPtr);
 /* 10 */
-TCLOOAPI Tcl_Obj *	Tcl_MethodName(Tcl_Method method);
+EXTERN Tcl_Obj *	Tcl_MethodName(Tcl_Method method);
 /* 11 */
-TCLOOAPI Tcl_Method	Tcl_NewInstanceMethod(Tcl_Interp *interp,
+EXTERN Tcl_Method	Tcl_NewInstanceMethod(Tcl_Interp *interp,
 				Tcl_Object object, Tcl_Obj *nameObj,
 				int isPublic, const Tcl_MethodType *typePtr,
 				ClientData clientData);
 /* 12 */
-TCLOOAPI Tcl_Method	Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls,
+EXTERN Tcl_Method	Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls,
 				Tcl_Obj *nameObj, int isPublic,
 				const Tcl_MethodType *typePtr,
 				ClientData clientData);
 /* 13 */
-TCLOOAPI Tcl_Object	Tcl_NewObjectInstance(Tcl_Interp *interp,
+EXTERN Tcl_Object	Tcl_NewObjectInstance(Tcl_Interp *interp,
 				Tcl_Class cls, const char *nameStr,
 				const char *nsNameStr, int objc,
 				Tcl_Obj *const *objv, int skip);
 /* 14 */
-TCLOOAPI int		Tcl_ObjectDeleted(Tcl_Object object);
+EXTERN int		Tcl_ObjectDeleted(Tcl_Object object);
 /* 15 */
-TCLOOAPI int		Tcl_ObjectContextIsFiltering(
+EXTERN int		Tcl_ObjectContextIsFiltering(
 				Tcl_ObjectContext context);
 /* 16 */
-TCLOOAPI Tcl_Method	Tcl_ObjectContextMethod(Tcl_ObjectContext context);
+EXTERN Tcl_Method	Tcl_ObjectContextMethod(Tcl_ObjectContext context);
 /* 17 */
-TCLOOAPI Tcl_Object	Tcl_ObjectContextObject(Tcl_ObjectContext context);
+EXTERN Tcl_Object	Tcl_ObjectContextObject(Tcl_ObjectContext context);
 /* 18 */
-TCLOOAPI int		Tcl_ObjectContextSkippedArgs(
+EXTERN int		Tcl_ObjectContextSkippedArgs(
 				Tcl_ObjectContext context);
 /* 19 */
-TCLOOAPI ClientData	Tcl_ClassGetMetadata(Tcl_Class clazz,
+EXTERN ClientData	Tcl_ClassGetMetadata(Tcl_Class clazz,
 				const Tcl_ObjectMetadataType *typePtr);
 /* 20 */
-TCLOOAPI void		Tcl_ClassSetMetadata(Tcl_Class clazz,
+EXTERN void		Tcl_ClassSetMetadata(Tcl_Class clazz,
 				const Tcl_ObjectMetadataType *typePtr,
 				ClientData metadata);
 /* 21 */
-TCLOOAPI ClientData	Tcl_ObjectGetMetadata(Tcl_Object object,
+EXTERN ClientData	Tcl_ObjectGetMetadata(Tcl_Object object,
 				const Tcl_ObjectMetadataType *typePtr);
 /* 22 */
-TCLOOAPI void		Tcl_ObjectSetMetadata(Tcl_Object object,
+EXTERN void		Tcl_ObjectSetMetadata(Tcl_Object object,
 				const Tcl_ObjectMetadataType *typePtr,
 				ClientData metadata);
 /* 23 */
-TCLOOAPI int		Tcl_ObjectContextInvokeNext(Tcl_Interp *interp,
+EXTERN int		Tcl_ObjectContextInvokeNext(Tcl_Interp *interp,
 				Tcl_ObjectContext context, int objc,
 				Tcl_Obj *const *objv, int skip);
 /* 24 */
-TCLOOAPI Tcl_ObjectMapMethodNameProc * Tcl_ObjectGetMethodNameMapper(
+EXTERN Tcl_ObjectMapMethodNameProc * Tcl_ObjectGetMethodNameMapper(
 				Tcl_Object object);
 /* 25 */
-TCLOOAPI void		Tcl_ObjectSetMethodNameMapper(Tcl_Object object,
+EXTERN void		Tcl_ObjectSetMethodNameMapper(Tcl_Object object,
 				Tcl_ObjectMapMethodNameProc *mapMethodNameProc);
 /* 26 */
-TCLOOAPI void		Tcl_ClassSetConstructor(Tcl_Interp *interp,
+EXTERN void		Tcl_ClassSetConstructor(Tcl_Interp *interp,
 				Tcl_Class clazz, Tcl_Method method);
 /* 27 */
-TCLOOAPI void		Tcl_ClassSetDestructor(Tcl_Interp *interp,
+EXTERN void		Tcl_ClassSetDestructor(Tcl_Interp *interp,
 				Tcl_Class clazz, Tcl_Method method);
 /* 28 */
-TCLOOAPI Tcl_Obj *	Tcl_GetObjectName(Tcl_Interp *interp,
+EXTERN Tcl_Obj *	Tcl_GetObjectName(Tcl_Interp *interp,
 				Tcl_Object object);
 
 typedef struct {
@@ -215,4 +226,7 @@ extern const TclOOStubs *tclOOStubsPtr;
 #endif /* defined(USE_TCLOO_STUBS) */
 
 /* !END!: Do not edit above this line. */
+
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLIMPORT
 #endif /* _TCLOODECLS */
diff --git a/generic/tclOOIntDecls.h b/generic/tclOOIntDecls.h
index acafb18..f0e3ee5 100644
--- a/generic/tclOOIntDecls.h
+++ b/generic/tclOOIntDecls.h
@@ -5,6 +5,17 @@
 #ifndef _TCLOOINTDECLS
 #define _TCLOOINTDECLS
 
+#undef TCL_STORAGE_CLASS
+#ifdef BUILD_tcl
+#   define TCL_STORAGE_CLASS DLLEXPORT
+#else
+#   ifdef USE_TCL_STUBS
+#      define TCL_STORAGE_CLASS
+#   else
+#      define TCL_STORAGE_CLASS DLLIMPORT
+#   endif
+#endif
+
 /* !BEGIN!: Do not edit below this line. */
 
 /*
@@ -12,46 +23,46 @@
  */
 
 /* 0 */
-TCLOOAPI Tcl_Object	TclOOGetDefineCmdContext(Tcl_Interp *interp);
+EXTERN Tcl_Object	TclOOGetDefineCmdContext(Tcl_Interp *interp);
 /* 1 */
-TCLOOAPI Tcl_Method	TclOOMakeProcInstanceMethod(Tcl_Interp *interp,
+EXTERN 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);
 /* 2 */
-TCLOOAPI Tcl_Method	TclOOMakeProcMethod(Tcl_Interp *interp,
+EXTERN 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);
 /* 3 */
-TCLOOAPI Method *	TclOONewProcInstanceMethod(Tcl_Interp *interp,
+EXTERN Method *		TclOONewProcInstanceMethod(Tcl_Interp *interp,
 				Object *oPtr, int flags, Tcl_Obj *nameObj,
 				Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
 				ProcedureMethod **pmPtrPtr);
 /* 4 */
-TCLOOAPI Method *	TclOONewProcMethod(Tcl_Interp *interp, Class *clsPtr,
+EXTERN Method *		TclOONewProcMethod(Tcl_Interp *interp, Class *clsPtr,
 				int flags, Tcl_Obj *nameObj,
 				Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
 				ProcedureMethod **pmPtrPtr);
 /* 5 */
-TCLOOAPI int		TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp,
+EXTERN int		TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp,
 				int objc, Tcl_Obj *const *objv,
 				int publicOnly, Class *startCls);
 /* 6 */
-TCLOOAPI int		TclOOIsReachable(Class *targetPtr, Class *startPtr);
+EXTERN int		TclOOIsReachable(Class *targetPtr, Class *startPtr);
 /* 7 */
-TCLOOAPI Method *	TclOONewForwardMethod(Tcl_Interp *interp,
+EXTERN Method *		TclOONewForwardMethod(Tcl_Interp *interp,
 				Class *clsPtr, int isPublic,
 				Tcl_Obj *nameObj, Tcl_Obj *prefixObj);
 /* 8 */
-TCLOOAPI Method *	TclOONewForwardInstanceMethod(Tcl_Interp *interp,
+EXTERN Method *		TclOONewForwardInstanceMethod(Tcl_Interp *interp,
 				Object *oPtr, int isPublic, Tcl_Obj *nameObj,
 				Tcl_Obj *prefixObj);
 /* 9 */
-TCLOOAPI Tcl_Method	TclOONewProcInstanceMethodEx(Tcl_Interp *interp,
+EXTERN Tcl_Method	TclOONewProcInstanceMethodEx(Tcl_Interp *interp,
 				Tcl_Object oPtr,
 				TclOO_PreCallProc *preCallPtr,
 				TclOO_PostCallProc *postCallPtr,
@@ -60,7 +71,7 @@ TCLOOAPI Tcl_Method	TclOONewProcInstanceMethodEx(Tcl_Interp *interp,
 				Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
 				int flags, void **internalTokenPtr);
 /* 10 */
-TCLOOAPI Tcl_Method	TclOONewProcMethodEx(Tcl_Interp *interp,
+EXTERN Tcl_Method	TclOONewProcMethodEx(Tcl_Interp *interp,
 				Tcl_Class clsPtr,
 				TclOO_PreCallProc *preCallPtr,
 				TclOO_PostCallProc *postCallPtr,
@@ -69,22 +80,22 @@ TCLOOAPI Tcl_Method	TclOONewProcMethodEx(Tcl_Interp *interp,
 				Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
 				int flags, void **internalTokenPtr);
 /* 11 */
-TCLOOAPI int		TclOOInvokeObject(Tcl_Interp *interp,
+EXTERN int		TclOOInvokeObject(Tcl_Interp *interp,
 				Tcl_Object object, Tcl_Class startCls,
 				int publicPrivate, int objc,
 				Tcl_Obj *const *objv);
 /* 12 */
-TCLOOAPI void		TclOOObjectSetFilters(Object *oPtr, int numFilters,
+EXTERN void		TclOOObjectSetFilters(Object *oPtr, int numFilters,
 				Tcl_Obj *const *filters);
 /* 13 */
-TCLOOAPI void		TclOOClassSetFilters(Tcl_Interp *interp,
+EXTERN void		TclOOClassSetFilters(Tcl_Interp *interp,
 				Class *classPtr, int numFilters,
 				Tcl_Obj *const *filters);
 /* 14 */
-TCLOOAPI void		TclOOObjectSetMixins(Object *oPtr, int numMixins,
+EXTERN void		TclOOObjectSetMixins(Object *oPtr, int numMixins,
 				Class *const *mixins);
 /* 15 */
-TCLOOAPI void		TclOOClassSetMixins(Tcl_Interp *interp,
+EXTERN void		TclOOClassSetMixins(Tcl_Interp *interp,
 				Class *classPtr, int numMixins,
 				Class *const *mixins);
 
@@ -160,4 +171,7 @@ extern const TclOOIntStubs *tclOOIntStubsPtr;
 #endif /* defined(USE_TCLOO_STUBS) */
 
 /* !END!: Do not edit above this line. */
+
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLIMPORT
 #endif /* _TCLOOINTDECLS */
-- 
cgit v0.12