Index: tclooConfig.sh ================================================================== --- tclooConfig.sh +++ tclooConfig.sh @@ -4,7 +4,7 @@ TCLOO_LIB_SPEC="" TCLOO_STUB_LIB_SPEC="" TCLOO_INCLUDE_SPEC="" # The next should copy TCL_PRIVATE_INCLUDE_SPEC, but I don't use it anyway. TCLOO_PRIVATE_INCLUDE_SPEC="" -TCLOO_CFLAGS=-DUSE_TCLOO_STUBS +TCLOO_CFLAGS= TCLOO_VERSION="8.6" Index: tdbc/configure ================================================================== --- tdbc/configure +++ tdbc/configure @@ -2011,11 +2011,11 @@ fi else - TCLOO_CFLAGS="-DUSE_TCLOO_STUBS" + TCLOO_CFLAGS="" fi fi # Announce what versions of Tcl (and TclOO) are needed TCL_VERSION_REQ=8.5; TCL_VERSION_DESIRED=8.6; Index: tdbc/configure.in ================================================================== --- tdbc/configure.in +++ tdbc/configure.in @@ -54,11 +54,11 @@ fi if test "${TCL_MINOR_VERSION}" -eq 5 ; then TEA_PATH_CONFIG(tcloo) TEA_LOAD_CONFIG(tcloo) else - TCLOO_CFLAGS="-DUSE_TCLOO_STUBS" + TCLOO_CFLAGS="" fi fi # Announce what versions of Tcl (and TclOO) are needed TCL_VERSION_REQ=8.5; AC_SUBST(TCL_VERSION_REQ) TCL_VERSION_DESIRED=8.6; AC_SUBST(TCL_VERSION_DESIRED) Index: tdbc/generic/tdbc.decls ================================================================== --- tdbc/generic/tdbc.decls +++ tdbc/generic/tdbc.decls @@ -19,12 +19,13 @@ epoch 0 scspec TDBCAPI # The public API for TDBC +# Just a dummy definition, meant to keep TDBC_STUBS_REVISION the same declare 0 current { - int Tdbc_Init(Tcl_Interp* interp) + int Tdbc_Init_(Tcl_Interp* interp) } declare 1 current { Tcl_Obj* Tdbc_TokenizeSql(Tcl_Interp* interp, const char* statement) } declare 2 current { Index: tdbc/generic/tdbc.h ================================================================== --- tdbc/generic/tdbc.h +++ tdbc/generic/tdbc.h @@ -16,16 +16,31 @@ #ifndef TDBC_H_INCLUDED #define TDBC_H_INCLUDED 1 #include -#if defined(BUILD_tdbc) -# define TDBCAPI DLLEXPORT -# undef USE_TDBC_STUBS +#ifndef TDBCAPI +# if defined(BUILD_tdbc) +# define TDBCAPI MODULE_SCOPE +# else +# define TDBCAPI extern +# undef USE_TDBC_STUBS +# define USE_TDBC_STUBS 1 +# endif +#endif + +#undef TCL_STORAGE_CLASS +#ifdef BUILD_tdbc +# define TCL_STORAGE_CLASS DLLEXPORT #else -# define TDBCAPI DLLIMPORT +# define TCL_STORAGE_CLASS #endif + +EXTERN int Tdbc_Init(Tcl_Interp *interp); + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT /* * TDBC_VERSION and TDBC_PATCHLEVEL here must match the ones that * appear near the top of configure.in. */ Index: tdbc/generic/tdbcDecls.h ================================================================== --- tdbc/generic/tdbcDecls.h +++ tdbc/generic/tdbcDecls.h @@ -13,11 +13,11 @@ * RCS: @(#) $Id$ * */ #if defined(USE_TDBC_STUBS) - extern const char* TdbcInitializeStubs( + TDBCAPI const char* TdbcInitializeStubs( Tcl_Interp* interp, const char* version, int epoch, int revision); # define Tdbc_InitStubs(interp) \ (TdbcInitializeStubs(interp, TDBC_VERSION, TDBC_STUBS_EPOCH, \ TDBC_STUBS_REVISION)) #else @@ -35,11 +35,11 @@ /* * Exported function declarations: */ /* 0 */ -TDBCAPI int Tdbc_Init (Tcl_Interp* interp); +TDBCAPI int Tdbc_Init_ (Tcl_Interp* interp); /* 1 */ TDBCAPI Tcl_Obj* Tdbc_TokenizeSql (Tcl_Interp* interp, const char* statement); /* 2 */ TDBCAPI const char* Tdbc_MapSqlState (const char* sqlstate); @@ -50,19 +50,19 @@ int magic; int epoch; int revision; const struct TdbcStubHooks *hooks; - int (*tdbc_Init) (Tcl_Interp* interp); /* 0 */ + int (*tdbc_Init_) (Tcl_Interp* interp); /* 0 */ Tcl_Obj* (*tdbc_TokenizeSql) (Tcl_Interp* interp, const char* statement); /* 1 */ const char* (*tdbc_MapSqlState) (const char* sqlstate); /* 2 */ } TdbcStubs; #ifdef __cplusplus extern "C" { #endif -extern const TdbcStubs *tdbcStubsPtr; +TDBCAPI const TdbcStubs *tdbcStubsPtr; #ifdef __cplusplus } #endif #if defined(USE_TDBC_STUBS) @@ -69,13 +69,13 @@ /* * Inline function declarations: */ -#ifndef Tdbc_Init -#define Tdbc_Init \ - (tdbcStubsPtr->tdbc_Init) /* 0 */ +#ifndef Tdbc_Init_ +#define Tdbc_Init_ \ + (tdbcStubsPtr->tdbc_Init_) /* 0 */ #endif #ifndef Tdbc_TokenizeSql #define Tdbc_TokenizeSql \ (tdbcStubsPtr->tdbc_TokenizeSql) /* 1 */ #endif Index: tdbc/generic/tdbcStubInit.c ================================================================== --- tdbc/generic/tdbcStubInit.c +++ tdbc/generic/tdbcStubInit.c @@ -14,19 +14,21 @@ */ #include "tdbcInt.h" MODULE_SCOPE const TdbcStubs tdbcStubs; + +#define Tdbc_Init_ Tdbc_Init /* !BEGIN!: Do not edit below this line. */ const TdbcStubs tdbcStubs = { TCL_STUB_MAGIC, TDBC_STUBS_EPOCH, TDBC_STUBS_REVISION, 0, - Tdbc_Init, /* 0 */ + Tdbc_Init_, /* 0 */ Tdbc_TokenizeSql, /* 1 */ Tdbc_MapSqlState, /* 2 */ }; /* !END!: Do not edit above this line. */ Index: tdbc/generic/tdbcStubLib.c ================================================================== --- tdbc/generic/tdbcStubLib.c +++ tdbc/generic/tdbcStubLib.c @@ -17,18 +17,10 @@ #include #define USE_TDBC_STUBS 1 #include "tdbc.h" -/* - * 'extern' is the best scope that we can come up with for linking - * tdbcStubsPtr. We have no idea what linker scope a caller might - * want for it. MODULE_SCOPE would be right, but we don't know even - * whether the caller has the concept. - */ - -extern const TdbcStubs *tdbcStubsPtr; const TdbcStubs *tdbcStubsPtr = NULL; /* *----------------------------------------------------------------------------- * Index: tdbc/tdbcConfig.sh.in ================================================================== --- tdbc/tdbcConfig.sh.in +++ tdbc/tdbcConfig.sh.in @@ -74,8 +74,8 @@ # Path name where .tcl files in the tdbc package appear at build time. tdbc_BUILD_LIBRARY_PATH="@tdbc_SRC_DIR@/library" TDBC_BUILD_LIBRARY_PATH="@tdbc_SRC_DIR@/library" # Additional flags that must be passed to the C compiler to use tdbc -tdbc_CFLAGS=-DUSE_TDBC_STUBS -TDBC_CFLAGS=-DUSE_TDBC_STUBS +tdbc_CFLAGS= +TDBC_CFLAGS= Index: tdbc/tools/genStubs.tcl ================================================================== --- tdbc/tools/genStubs.tcl +++ tdbc/tools/genStubs.tcl @@ -677,10 +677,11 @@ proc genStubs::emitHeader {name} { variable outDir variable hooks variable epoch variable revision + variable scspec set capName [string toupper [string index $name 0]] append capName [string range $name 1 end] set CAPName [string toupper $name] @@ -708,11 +709,11 @@ emitSlots $name text append text "} ${capName}Stubs;\n" append text "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n" - append text "extern const ${capName}Stubs *${name}StubsPtr;\n" + append text "${scspec} const ${capName}Stubs *${name}StubsPtr;\n" append text "#ifdef __cplusplus\n}\n#endif\n" emitMacros $name text rewriteFile [file join $outDir ${name}Decls.h] $text @@ -730,14 +731,14 @@ # Results: # Returns the formatted output. proc genStubs::emitInit {name textVar} { variable hooks + variable interfaces variable epoch - variable revision - upvar $textVar text + set root 1 set capName [string toupper [string index $name 0]] append capName [string range $name 1 end] set CAPName [string toupper $name] @@ -748,11 +749,24 @@ append text $sep "&${sub}Stubs" set sep ",\n " } append text "\n\};\n" } - append text "\nconst ${capName}Stubs ${name}Stubs = \{\n" + foreach intf [array names interfaces] { + if {[info exists hooks($intf)]} { + if {[lsearch -exact $hooks($intf) $name] >= 0} { + set root 0 + break + } + } + } + + append text "\n" + if {!$root} { + append text "static " + } + append text "const ${capName}Stubs ${name}Stubs = \{\n" append text " TCL_STUB_MAGIC,\n" append text " ${CAPName}_STUBS_EPOCH,\n" append text " ${CAPName}_STUBS_REVISION,\n" if {[info exists hooks($name)]} { append text " &${name}StubHooks,\n" Index: tdbcmysql/configure ================================================================== --- tdbcmysql/configure +++ tdbcmysql/configure @@ -1758,11 +1758,11 @@ Found configuration for Tcl ${TCL_VERSION}." >&5 echo "$as_me: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6 or newer. Found configuration for Tcl ${TCL_VERSION}." >&2;} { (exit 1); exit 1; }; } fi - TCLOO_CFLAGS='-DUSE_TCLOO_STUBS' + TCLOO_CFLAGS='' fi TCL_VERSION_REQ=8.6; # Index: tdbcmysql/configure.in ================================================================== --- tdbcmysql/configure.in +++ tdbcmysql/configure.in @@ -55,11 +55,11 @@ if test "${TCL_MAJOR_VERSION}" -eq 8 ; then if test "${TCL_MINOR_VERSION}" -lt 6 ; then AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6 or newer. Found configuration for Tcl ${TCL_VERSION}.]) fi - TCLOO_CFLAGS='-DUSE_TCLOO_STUBS' + TCLOO_CFLAGS='' fi TCL_VERSION_REQ=8.6; AC_SUBST(TCL_VERSION_REQ) TEA_PATH_CONFIG(tdbc) TEA_LOAD_CONFIG(tdbc) Index: tdbcodbc/configure ================================================================== --- tdbcodbc/configure +++ tdbcodbc/configure @@ -1751,11 +1751,11 @@ Found configuration for Tcl ${TCL_VERSION}." >&5 echo "$as_me: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6 or newer. Found configuration for Tcl ${TCL_VERSION}." >&2;} { (exit 1); exit 1; }; } fi - TCLOO_CFLAGS='-DUSE_TCLOO_STUBS' + TCLOO_CFLAGS='' fi TCL_VERSION_REQ=8.6; # Index: tdbcodbc/configure.in ================================================================== --- tdbcodbc/configure.in +++ tdbcodbc/configure.in @@ -48,11 +48,11 @@ if test "${TCL_MAJOR_VERSION}" -eq 8 ; then if test "${TCL_MINOR_VERSION}" -lt 6 ; then AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6 or newer. Found configuration for Tcl ${TCL_VERSION}.]) fi - TCLOO_CFLAGS='-DUSE_TCLOO_STUBS' + TCLOO_CFLAGS='' fi TCL_VERSION_REQ=8.6; AC_SUBST(TCL_VERSION_REQ) TEA_PATH_CONFIG(tdbc) TEA_LOAD_CONFIG(tdbc) Index: tdbcoracle/Makefile ================================================================== --- tdbcoracle/Makefile +++ tdbcoracle/Makefile @@ -146,11 +146,11 @@ SHARED_BUILD = 1 INCLUDES = -I/usr/local/include -I/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/public -I"/usr/local/include" # INCLUDES = -I/usr/local/include -I/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/public -I"/usr/local/include" @TK_INCLUDES@ @TK_XINCLUDES@ -PKG_CFLAGS = -DUSE_TCLOO_STUBS -DUSE_TDBC_STUBS +PKG_CFLAGS = # TCL_DEFS is not strictly need here, but if you remove it, then you # must make sure that configure.in checks for the necessary components # that your library may use. TCL_DEFS can actually be a problem if # you do not compile with a similar machine setup as the Tcl core was Index: tdbcoracle/configure ================================================================== --- tdbcoracle/configure +++ tdbcoracle/configure @@ -2005,11 +2005,11 @@ fi else - TCLOO_CFLAGS='-DUSE_TCLOO_STUBS' + TCLOO_CFLAGS='' fi fi # Index: tdbcoracle/configure.in ================================================================== --- tdbcoracle/configure.in +++ tdbcoracle/configure.in @@ -52,11 +52,11 @@ fi if test "${TCL_MINOR_VERSION}" -eq 5 ; then TEA_PATH_CONFIG(tcloo) TEA_LOAD_CONFIG(tcloo) else - TCLOO_CFLAGS='-DUSE_TCLOO_STUBS' + TCLOO_CFLAGS='' fi fi TEA_PATH_CONFIG(tdbc) TEA_LOAD_CONFIG(tdbc) Index: tdbcpostgres/configure ================================================================== --- tdbcpostgres/configure +++ tdbcpostgres/configure @@ -1751,11 +1751,11 @@ Found configuration for Tcl ${TCL_VERSION}." >&5 echo "$as_me: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6 or newer. Found configuration for Tcl ${TCL_VERSION}." >&2;} { (exit 1); exit 1; }; } fi - TCLOO_CFLAGS='-DUSE_TCLOO_STUBS' + TCLOO_CFLAGS='' fi TCL_VERSION_REQ=8.6; # Index: tdbcpostgres/configure.in ================================================================== --- tdbcpostgres/configure.in +++ tdbcpostgres/configure.in @@ -48,11 +48,11 @@ if test "${TCL_MAJOR_VERSION}" -eq 8 ; then if test "${TCL_MINOR_VERSION}" -lt 6 ; then AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6 or newer. Found configuration for Tcl ${TCL_VERSION}.]) fi - TCLOO_CFLAGS='-DUSE_TCLOO_STUBS' + TCLOO_CFLAGS='' fi TCL_VERSION_REQ=8.6; AC_SUBST(TCL_VERSION_REQ) TEA_PATH_CONFIG(tdbc) TEA_LOAD_CONFIG(tdbc)