Failed to build tcl8.1

Thomas Kowatsch Thomas.Kowatsch@stest.ch
Tue Aug 31 23:49:00 GMT 1999


Finally got it all compiled. I figured out what the problemwas, see below

<snip>

> I just renamed these function in there modules prepending a Tk. Then
> compile worked just fine but when it came to link the dll I got
> thousands of unresolved externals from tcl like
>   tkWindow.o: In function `Initialize':
>   //z/STS/TCU/thirdparty/WinNT/tk8.1/win/./../generic/tkWindow.c:2717:
> undefined reference to `_imp__Tcl_PkgRequire'
>   //z/STS/TCU/thirdparty/WinNT/tk8.1/win/./../generic/tkWindow.c:2721:
> undefined reference to `_imp__Tcl_GetThreadData'

This was because of a bug in tcl.h (same was in tk.h) together whenusing -DUSE_TCL_STUBS. In tcl.h there is
defined the TCL_STORAGE_CLASS
macro at the top like:

#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

That seems very correct. But at the end of tcl.h there was:

#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS

EXTERN int              Tcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp));

#endif /* RESOURCE_INCLUDED */

#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT

As I understood, to define the Tcl_AppInit TCL_STORAGE_CLASS must not be
defined. That's ok, but redefining TCL_STORAGE_CLASS after that looked
wrong for me, as it should be as in the top of the file. So I changed
it like in the top. Then I was able to build wish with just linking
against the stub library and no undefined reference occured.

> I figured out that this was due to the missing -ltcl81 in the buildline
> for the libtk81.dll. So I added that and then ... everything compiled
> ok. Then I installed everything in a temporary directory and tried to
> run it. tclsh81.exe semmed to be ok but when I ran wish81.exe I got
> a core. Loaded wish81.exe into gdb and run it. Following the output:

<snip>

Ok this was obviously the wrong approach linking with -ltcl81 and stub
lib together and was the reason for the core to happen. I now can run
it ok.

But a another little problem occured. There is no console input after
I started wish81.exe. When I start the cygwish80.exe coming with
b20.1 a console window pops up. I examined code again and found the
problem to be in tk8.1/win/winMain.c. There are two entry points in
there, one is main() and the other is WinMain(). If main() is called
(what is obviously done by cygwin) then before Tk_Main() is called
a variable consoleRequired is set to FALSE. If I start wish81.exe in
gdb and set this variable to TRUE before call to Tk_Main() a
console window pops up. In WinMain() the consoleRequired is TRUE
before call to Tk_Main(). My question is now, what to do:

1.) change code in main() for cygwin to set consoleRequired to TRUE
2.) Find a possibility to get WinMain be called (Any advise)

Can anybody help me on this?

TIA
Tommy

--
------------------------------------------------------------------------
Thomas Kowatsch                      | - Senior Software Engineer -
Switching Test Solutions AG          | mailto: thomas.kowatsch@stest.ch
Wavetek Wandel & Goltermann Divison5 | web   : http://www.stest.com
Friesenbergstr. 75                   | Phone : +41 1 454-6731
CH-8055 Zuerich                      | FAX   : +41 1 454-6612




--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list