From: geier AT forwiss DOT uni-passau DOT de (Roland Geier) Subject: Re: Tcl/Tk with extensions under cyg-win32? 17 Aug 1997 23:39:48 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199708180528.HAA05818.cygnus.gnu-win32@dior.forwiss.uni-passau.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Original-To: gnu-win32 AT cygnus DOT com X-Face: %JjDwL,CM#gbv*uICrNLdM9yk_LRxMh3DV'.fQ>iw'N;7([Jq}2|J#5o".kzM&>7tW`8T^Z buvRLp?jvQ+sbD3BND%=&D: lT%vT4p7cGcGRP5JO+F'^ X-Mailer: ELM [version 2.4ME+ PL31 (25)] Original-Sender: owner-gnu-win32 AT cygnus DOT com > I was hoping somebody has had some experience with what I want to do. I'd > like to compile Tk/Tcl 4.2/7.6 with several extensions, including itcl 2.2, > TclX, Expect, and Scotty (Tnm). I'd like to compile them as shared > libraries/loadable packages, if that is possible under cyg-win32. If not, I > suppose I can just link them in statically, it's just that I'd rather not. > > I was wondering if anyone had any experience in doing this and, if so, what > problems were run into. How much had to be changed to compile under > cyg-win32? What target opsys did you use, linux? What other things should I > be concerned about when I go about doing this. With tcl's dynamic package-concept you don't have to rebuild tcl/tk at all but use the provided b18-tcl/tk-binaries instead. Just make dlls from the extensions and use the package-mechanism to load them dynamically, that's all. I did that for itcl1.5 and my own extensions. If the generation of relocatable dlls won't work for you (perhaps due to some weird c++-code in your extensions) make static-packages ('.a'-archives) and use the tcl-package-mechanism for static packages. Then you won't have to recompile tcl/tk either but only extend the interpreter. Assume you have an gnuwin32-compiled archive 'itcl-2.2.a' you want to use as a static package in tcl. Then build your own interpreter that has the package included: : #include : : static int : loadStaticPackages( Tcl_Interp* interp ) { : char loadCmd[256]; : : Tcl_StaticPackage( NULL, "itcl" , Itcl_Init, NULL ); : strcpy( loadCmd, "load \"\" itcl" ); : Tcl_Eval( interp, loadCmd ); : } : : : int : Tcl_AppInit(Tcl_Interp* interp) { : if (Tcl_Init(interp) == TCL_ERROR) { : return TCL_ERROR; : } : return ( loadStaticPackages( interp ) ); : } : : int : main(int argc, char** argv) { : Tcl_Main(argc, argv, Tcl_AppInit); : return 0; : } Now you can use "package require Itcl" in your tcl-code in the same manner as if you wanted to load the package dynamically. So if you succeed to build dll's from your extensions in the future (perhaps with oncoming b19) you wont't have to change your tcl-code. Hth, --- Roland. --- Roland Geier Phone: ++49 (8505) 92182 Universitaet Passau, GER Fax: ++49 (8505) 922311 Lehrstuhl Prof. Dr. Donner geier AT forwiss DOT uni-passau DOT de D-94032 Passau http://www.uni-passau.de/~geier/ - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".