Re: [tkined] [Q] How to convert to C or binary code

clau@plaintree.com
Thu, 27 Nov 97 01:14:15 est

This is an interesting subject.

Assuming you have created some procedures in pure Tcl script, there
are a number of ways to invoke those script from C or Java:

From C:

1. simply create an interpreter, source your script and evalute the
procedure

interp = Tcl_CreateInterp();
Tcl_EvalFile( interp, "your_script.tcl" );
Tcl_Eval( interp, "your_tcl_proc your_arguments" );

That's all!

2. Spawn the script as a child process, and talk to it via
stdin/stdout. If you're developing on UNIX, you may even be able
to do this I/O asynchronously with the child process. Useful if
you have some background job to run. I think tkined uses this
method to communicate with the jobs.

From Java:

Unfortunately, this is not so obvious. You can probably spawn the TCL
process and communicate with it via socket pipes. Look up the socket
command in TCL.

Sun is rewriting the Tcl interpreter in Java. I think they have some
alpha code available. You'll be able to use method 1 in C. However,
scotty probably won't be their. Sometimes I think if it is worthwhile
for Sun to do that port since there are so many extensions to Tcl and
there won't be much incentive to port a hugh base of client software
that is working fine.

*** Disclaimer ***
The above discussion is my personal opinion on publicly known
technology and is in no way related to or my employer or my
employment.

______________________________ Reply Separator _________________________________
Subject: [tkined] [Q] How to convert to C or binary code
Author: Lu Shan <lushan@carnation.njnet.edu.cn> at internet
Date: 11/27/97 2:03 AM

Hi,
I have built a little program using scotty, because scotty give me
a lot of tools. And now I want to call this program in C and Java, but I
do not know how to realize it. Could any one tell me a way?

Thanks.
-------------
Lu Shan

--
!! This message is brought to you via the `tkined & scotty' mailing list. 
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>. 
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.
     

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.