Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why is Tcl_Main not in the Stubs table?

0 views
Skip to first unread message

David Gravereaux

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
I'm trying to make the Itcl shell Stub'ified.

I guess I could just get it from the outside with:

#undef Tcl_Main
typedef void (*LPFN_Tcl_Main) (int argc, char **argv,
Tcl_AppInitProc *appInitProc);
LPFN_Tcl_Main Tcl_Main = NULL;
HMODULE hTcl;

hTcl = LoadLibrary("tcl81.dll");
Tcl_Main = GetProcAddress(hTcl, "Tcl_Main");


Fixing Tcl_Main as an unresolved external still doesn't solve for the
ability to initialize the shell's tclStubPtr. There's a solution to
Stub'ifying Tcl apps somewhere, but I haven't found it yet.

I could do Tcl_PkgRequireEx if only that wasn't in the Stub table.
This is a catch22.


* David Gravereaux *
Tomahawk Software Group

Jan Nijtmans

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
David Gravereaux wrote:
> Fixing Tcl_Main as an unresolved external still doesn't solve for the
> ability to initialize the shell's tclStubPtr. There's a solution to
> Stub'ifying Tcl apps somewhere, but I haven't found it yet.

The solution is not to compile tclAppInit.c and tkAppInit.c with
-DUSE_TCL_STUBS neither -DUSE_TK_STUBS. The function Tcl_Main()
creates an interpreter, while the stub table can only be
initialized when there already is an interpreter. This
chicken-and-egg problem cannot be solved by exporting Tcl_Main()
through the stub table, only by not using -DUSE_TCL_STUBS.

Hope this helps,

--
Jan Nijtmans, CMG Arnhem B.V.
email: Jan.Ni...@wxs.nl (private)
Jan.Ni...@cmg.nl (work)
url: http://home.wxs.nl/~nijtmans/

David Gravereaux

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
Jan Nijtmans <Jan.Ni...@wxs.nl> wrote:

>The solution is not to compile tclAppInit.c and tkAppInit.c with
>-DUSE_TCL_STUBS neither -DUSE_TK_STUBS.

That's not a solution. That's a step backwards.

This my problem with [incr Tcl]:

itclsh30.exe has a load-time dependency for itcl30.dll and tcl81.dll.
tcl81.dll is in the same path as itclsh30.exe (Tcl/bin , no problem
here), but itcl30.dll is in Tcl/lib/itcl3.0. I don't want import
dependencies for either. For the shell to start, I have to add
Tcl/lib/itcl3.0 to my path. Extensions are free and clear from this
by using Stubs. Why not the same thing for Tcl apps, too?

Yes, I know this is not how Stubs is supposed to be used, but this is
what I want to do.

Jan Nijtmans

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
David Gravereaux wrote:
> This my problem with [incr Tcl]:
>
> itclsh30.exe has a load-time dependency for itcl30.dll and tcl81.dll.


You don't need itclsh30.exe. Just use tclsh81.exe, and dyncamically
load itcl30.dll into memory with "package require Itcl". If you
modify itcl to call Tcl_InitStubs() in stead of Tcl_PkgRequire(),
you can remove the dependancy on tcl81.dll.

David Gravereaux

unread,
May 20, 1999, 3:00:00 AM5/20/99
to
Jan Nijtmans <Jan.Ni...@wxs.nl> wrote:

>David Gravereaux wrote:
>> This my problem with [incr Tcl]:
>>
>> itclsh30.exe has a load-time dependency for itcl30.dll and tcl81.dll.
>
>
>You don't need itclsh30.exe. Just use tclsh81.exe, and dyncamically
>load itcl30.dll into memory with "package require Itcl". If you
>modify itcl to call Tcl_InitStubs() in stead of Tcl_PkgRequire(),
>you can remove the dependancy on tcl81.dll.


Whoop! That's right. I forgot itcl30.dll is a 100% extension now.
It doesn't need it's own shell.

Tnks.

0 new messages