Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allow user to run C program w/ TCL, without installing TCL/TK

Status
Not open for further replies.

nater

Programmer
Jun 14, 2002
21
CA
Hi all.. I'd like to find some way to allow a user to run a C program I've written with a TK GUI (I used Tk_Main to incorporate tk into my C code) without having to install TCL/TK. I thought this would be a simple matter of throwing some .dlls in the directory, but once I put in Tcl83.dll and Tk83.dll, it complained about init.tcl, then about not being able to find Tk_LibraryInfo or something..

etc

I'm sure this is something that people have done before.. So if anybody knows the 'right' way to do this, your help would be much appreciated.
Ideally I'd like both Unix and Windows versions, but any info would be helpful.

Thanks.

Nathan
 
Hello all,

I wanted to take the beautiful features of TCL/TK and incorporate it into my c program. And then compile and run it. Can I do that? If yes, could u pls. tell me what is the procedure for that?
I want to call a TK file, which will show some GUI effect, from a c porgram. Is it possible?
And then I want to install my application on those machines which do not have TCL/TK installed on them. Is this possible? Will it work..?
I am novice to TCL/TK.. so I request you to guide me on this front.
I also want to write a socket based application which will use TK functionalities (GUI effects) using C language.
I want it to run on Linux and windows Operating system.
Please show me the path..so I can try to walk on it...

Thanks again

sachin s.
 
Hello all,

I wanted to take the beautiful features of TCL/TK and incorporate it into my c program. And then compile and run it. Can I do that? If yes, could u pls. tell me what is the procedure for that?
I want to call a TK file, which will show some GUI effect, from a c porgram. Is it possible?
And then I want to install my application on those machines which do not have TCL/TK installed on them. Is this possible? Will it work..?
I am novice to TCL/TK.. so I request you to guide me on this front.
I also want to write a socket based application which will use TK functionalities (GUI effects) using C language.
I want it to run on Linux and windows Operating system.
Please show me the path..so I can try to walk on it...

Thanks again

sachin s.
 
Uhh.. well, that doesn't exactly answer my question...
But I can tell you how to do the incorporation part. At least one way to do it.

If you want to run in from you C executable (rather than loading C packages into TCL/TK, which is somewhat easier, and documented all over the place, you've got to use Tk_Main. All your main function has to do is call Tk_Main, with the first argument in argv (argv[1], not argv[0], which represents the command name) as the tcl/tk script you want to execute. The easiest way to do this is just to pass it from the command line of your C executable.

Look at the Tk_Main documentation for details, but basically it'll initialize Tk, run the function (which you create) Tcl_AppInit, and then call your script.

See the file TkAppInit.c in your lib/tk8.3 directory for a template of how to set up Tcl_AppInit.

You create new functions to call from TCL in the same way as if you were loading a package into TCL. Look at Tcl_CreateObjCommand. This will allow you to call c functions from your TCL script.

I know that's not too detailed, but it's all I've got time for right now. I'm sure Avia will give you the 4 page version in a minute here. =) If you've got any more specific questions on snags you run into, I might be able to help.

Aaaand of course that doesn't help with running the executable independent of TCL, which was my original question.. So if anybody can help with that...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top