Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-06-13
02:46 • Closed ticket [633990ffff]: tcl.h always makes incorrect #define plus 3 othe... artifact: 4c160c37b7 user: hobbs
2003-11-13
08:55 • Ticket [633990ffff]: 1 change artifact: 9896415abb user: dgp
2003-07-19
03:03 • Ticket [633990ffff]: 1 change artifact: 36d06fee61 user: davygrvy
03:00 • Ticket [633990ffff]: 5 changes artifact: e4042f06bb user: edwardross
02:59 • Ticket [633990ffff]: 5 changes artifact: 0761c4b3ae user: davygrvy
02:43 • Ticket [633990ffff]: 1 change artifact: e959741e31 user: hobbs
2003-02-17
03:13 • Ticket [633990ffff]: 4 changes artifact: 219c7dcf2b user: nobody
02:50 • Ticket [633990ffff]: 5 changes artifact: 3082c2de4c user: kennykb
2002-12-11
05:36 • Ticket [633990ffff]: 4 changes artifact: 028ba9292a user: davygrvy
2002-11-06
02:27 • Ticket [633990ffff]: 4 changes artifact: c355564c3c user: edwardross
02:27 • Add attachment tcl.h to ticket [633990ffff] artifact: 41a4591fa5 user: edwardross
2002-11-05
19:27 • New ticket [633990ffff] tcl.h always makes incorrect #define. artifact: 0147a9bfce user: edwardross

tcl.h always makes incorrect #define

Closed / Out of Date633990ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 19 years ago
Descriptionplain2002-11-05 19:27:37
PROBLEM
---------------

in tcl.h TCL_STORAGE_CLASS is correctly defined arround
line 249 with the following:

#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

However later in the same file arround line 1691, it is
incorrectly defined as:

#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS

EXTERN intTcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp));

#endif /* RESOURCE_INCLUDED */

#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT

This usually doesn't cause any problems, but if you
then try to link with proWrap.h, this incorrect
definition of TCL_STORAGE_CLASS means that we can't
link.  Would also be a problem for linking with static
libs rather than dlls  (obviously talking about on
windows here).

Workaround
------------------

Undefine TCL_STORAGE_CLASS before include proWrap.h.

Possible Resolution
-----------------------------

(1) change the definition at line 249 to:

#ifdef __cplusplus
#  define HEAD_EXTERN extern "C"
#else
#  define EXTERN extern TCL_STORAGE_CLASS
#endif

#define EXTERN HEAD_EXTERN TCL_STORAGE_CLASS

(2) Remove all further defines/undefines for
TCL_STORAGE_CLASS at line 1694 etc.

(3) change the declaration at line 1694 to:
EXTERN_HEAD int Tcl_AppInit _ANSI_ARGS_((Tcl_Interp
*interp));
edwardrossplain2002-11-06 02:27:38
File Added - 34689: tcl.h
davygrvyplain2002-12-11 05:36:35
Logged In: YES 
user_id=7549

See TIP #60

IMO, storage class is a big mess in Tcl.
kennykbplain2003-02-17 02:50:53
Logged In: YES 
user_id=99768

Jeff, what's the proper TEA2 thing to do here? I know that others
build extensions quite successfully even with TclPro headers.
I'm thinking that this is either the original submitter doing something
wrong, or else something amiss in <prowrap.h>.
nobodyplain2003-02-17 03:13:38
Logged In: NO 

It is possible that I did something wrong.  However, it is
clear that the header file is incorrect.

What could be a valid reason for undefing TCL_STORAGE_CLASS
and then redefining it as DLLIMPORT?

It is obvious from the initial definition (arround
line 249) that there are three possible correct values.

The undefining of the TCL_STORAGE_CLASS is a complete hack.
 It is simply incorrect!
hobbs Ticket [633990ffff]: 1 change [History diff]2003-07-19 02:43:59
davygrvyplain2003-07-19 02:59:20
Logged In: YES 
user_id=7549

Please see tip#60, I have nothing to say on this specific 
problem except that it is covered there.
edwardrossplain2003-07-19 03:00:31
Logged In: YES 
user_id=578816

Looks like I made a mistake in my suggested resolution. 
Perhaps I meant:

Possible Resolution
-----------------------------

(1) ADD the following definition after the definition of
TCL_STORAGE CLASS:

#ifdef __cplusplus
# define HEAD_EXTERN extern "C"
#else
# define HEAD_EXTERN extern
#endif

#define EXTERN HEAD_EXTERN TCL_STORAGE_CLASS

(2) Remove all further defines/undefines for
TCL_STORAGE_CLASS at line 1694 etc.

(3) change the declaration at line 1694 to:
HEAD_EXTERN int Tcl_AppInit _ANSI_ARGS_((Tcl_Interp
*interp));
davygrvy Ticket [633990ffff]: 1 change [History diff]2003-07-19 03:03:13
dgp Ticket [633990ffff]: 1 change [History diff]2003-11-13 08:55:46
hobbs Closed ticket [633990ffff]. [History diff]2007-06-13 02:46:24
Log in (anonymous is fine) to add a comment.

Attachments: