| Ticket UUID: | 220842 | |||
| Title: | Tk_InitStubs not usable with C++ | |||
| Type: | Bug | Version: | obsolete: 8.3 | |
| Submitter: | welch | Created on: | 2000-11-01 01:31:40 | |
| Subsystem: | 84. Unix Build | Assigned To: | davygrvy | |
| Priority: | 6 | Severity: | ||
| Status: | Closed | Last Modified: | 2002-04-07 06:28:13 | |
| Resolution: | Out of Date | Closed By: | hobbs | |
| Closed on: | 2002-04-06 23:28:13 | |||
| Description: |
OriginalBugID: 2078 Bug
Version: 8.1
SubmitDate: '1999-05-17'
LastModified: '2000-01-25'
Severity: LOW
Status: UnAssn
Submitter: pat
ChangedBy: hobbs
RelatedBugIDs: 1842
OS: Windows NT
OSVersion: 4.0 SP3
Machine: X86
Name:
Jan Nijtmans
ReproducibleScript:
When compiling a Tk-extension using C++, inclusion of tk.h means
that the name of the Tk_InitStubs() function is mangled. This
makes tkstub81.lib unusable for C++ extensions, unless it is
recompiled using a C++ compiler.
DesiredBehavior:
C++ extension using tk.h can link libtkstub8.1.a with
their extension, without the need to recompile it
using a C++ compiler.
Much better would be to use the EXTERN macro
in tk.h. Unfortunately this has the side-effect of
using __decl on Windows, which can be switched off
by undefining TCL_STORAGE_CLASS. This - in turn -
has the undesired side-effect that all function
declarations in tclDecls.h are affected, which
can prevented by moving this code to the end
of tk.h.
Patch:
*** generic/tk.h.origThu Apr 29 21:37:46 1999
--- generic/tk.hSat May 15 08:44:18 1999
***************
*** 1159,1173 ****
#define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, Tcl_CreateInterp())
- char *Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, char *version, int exact));
-
- #ifndef USE_TK_STUBS
-
- #define Tk_InitStubs(interp, version, exact) - Tcl_PkgRequire(interp, "Tk", version, exact)
-
- #endif
-
/*
*--------------------------------------------------------------
--- 1159,1164 ----
***************
*** 1200,1205 ****
--- 1191,1214 ----
*/
#include "tkDecls.h"
+
+ /*
+ * Convenience declaration of Tk_InitStubs.
+ * This function is not *implemented* by the tcl library, so the storage
+ * class is neither DLLEXPORT nor DLLIMPORT
+ */
+
+ #undef TCL_STORAGE_CLASS
+ #define TCL_STORAGE_CLASS
+
+ EXTERN char *Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, char *version, int exact));
+
+ #ifndef USE_TK_STUBS
+
+ #define Tk_InitStubs(interp, version, exact) + Tcl_PkgRequire(interp, "Tk", version, exact)
+
+ #endif
/*
* Tcl commands exported by Tk:
PatchFiles:
tk.h
1842 has older version of same idea.
-- 01/25/2000 hobbs
| |||
| User Comments: |
hobbs added on 2002-04-07 06:28:13:
Logged In: YES user_id=72656 According to Dave we've fiddled enough between know and then not to have this problem. davygrvy added on 2002-04-07 05:23:48: Logged In: YES user_id=7549 I was playing around with an MFC app that puts Tk in by way Stubs, and didn't have a problem. The code on the HEAD, anyways. dgp added on 2002-04-06 23:09:35: File Added - 20662: patch2 dgp added on 2002-04-06 23:09:34: Logged In: YES user_id=80530 and another patch... dgp added on 2002-04-06 23:07:59: File Added - 20661: patch Logged In: YES user_id=80530 >From "Jan Nijtmans" <[email protected]> The story behind this is: - Because the tclStubsPtr variables cannot be exported from tcl83.dll, the Tcl_InitStubs() call in tclBasic.c makes no sense on Windows: It initializes variables which are not accessible from outside the dll. - In order to prevent that Tcl_InitStubs is exported from tcl83.dll, remove tclStubLib.c from the makefile. Since TEA there are two makefiles where this should be done. If you included Makefile.mingw now, the same change should be done there. - For Tcl_InitStubs() the same remark holds as for Tcl_AppInit(): It is no longer a function supplied by the Tcl library. That's why moving it to the end of tcl.h would be more logical. On UNIX this makes no difference, but on Windows it does. The original patch fixed an additional problem, making the Xxx_InitStubs() functions work for C++ as well. This problem has since then been fixed in another way: By adding the 'extern "C"' in the beginnings of tcl.h and tk.h dgp added on 2002-04-06 23:00:43: Logged In: YES user_id=80530 See also Bug 219971 hobbs added on 2001-12-28 02:12:06: Logged In: YES user_id=72656 is this valid anymore? | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki