Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z - Internet FAQ Archives

comp.lang.tcl Frequently Asked Questions (March 07, 2005) (1/6)
Section - -IV- Other than C, what languages can talk to tcl/tk?

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Property taxes ]

Top Document: comp.lang.tcl Frequently Asked Questions (March 07, 2005) (1/6)
Previous Document: -III- Do these packages run on my machine?
Next Document: -V- What training material is available?
See reader questions & answers on this topic! - Help others by sharing your knowledge

A. Shell

	There are a number of interfaces which are shell-like.  The
first is tclsh, which comes as a sample program implementing a Tcl
interpreter as a part of the Tcl distribution.  Another is wish, which
is a shell-like interface that is a part of the Tk package.  Many of
the other extensions also build interpreters as well.  The tclX extension
is an example - it builds an interpreter called tcl as well as one called

B. C++

	There is a package called Objectify which can be used to assist
one in turning C++ classes into Tcl object types.

	If you wish to use C++ with Tcl then you must have your main()
in a source file that is compiled with a C++ compiler; this will
ensure that the necessary C++ pre-main initialization code is

	You can call tcl and tk routines (or other C code) routines from C++
provided that the function prototypes avoid C++ name mangling by using
the C++ linkage specification :

	extern "C"  ... prototype ...

	Fortunately, tcl.h and tk.h will provide these specifications when
compiled with a C++ compiler and so you can just use them directly.

	You can construct your main using normal tcl and tk routines,
or use tkMain.c and tkAppInit.c with minor modifications. Ken Yap's
patch, obtainable from
<URL: >,
is a patch that allows tk 3.6 main.c and other extension routines to be
compiled with a C++ compiler.  Thanks to Ken Yap
<URL: > for this code.

	C++ functions and static class member functions can be used to
create Tcl command using Tcl_CreateCommand in the normal way.
Non-static member functions cannot be used so simply, Tcl would
have to supply a "this" pointer.

	SWIG <URL: > is another great
resource for using C++ and Tcl.  To quote the author:

> SWIG is a code development tool created to solve real problems and
> make C/C++ programming more enjoyable. Simply stated, SWIG
> allows you to integrate common scripting languages such as Tcl,
> Perl, Python, and Guile with programs containing collections of
> functions written in C or C++. By using an interpreted scripting
> language with a C program, you can do a number of cool things like:
>         Build a powerful interface.
>         Rapidly prototype new features.
>         Interactively debug and test your code.
>         Develop a graphical user interface.
>         Build C/C++ modules for scripting language applications.
>         Save lots of time--allowing you to work on the real problem.
>         Impress your friends.

One user notes:
> To contrast SWIG with Objectify - SWIG has you prepare a small interface
> file that specifies what functions are to be wrapped, rather than adding
> macros to your original header file.  It also works with C, as well as
> C++.

C. Modula-3

	Norman Ramsey <URL: mailto:elan.uucp!nr > says:
	A long time back, Eric Muller posted a Modula-3 interface to
the C Tcl library.  I wrote down a Modula-3/Tcl interface that used
Modula-3 types rather than C types, and that used objects to build
closures for commands.  I wrote part of the implementation but never
finished it.  I have mailed copies to <URL: >,
who asked the question, and I will post them if there seems to be general

	Also, there is an interface between Tk and Modula-3 that is a part
of the Modula-3 archives on <URL: >, and Tcl-DP and
Modula-3 have been merged.

D. Eiffel

	<URL: > (Stephan Herrmann) says:
	... [the tclish package provides] the marriage of two very different
principles by means of combining two programming languages into a
hybrid program architecture.

	There are three classes for the user - tcl interpretor, tk application,
and tk window.  See <URL: > for

E. Ada

	<URL: > (Dennis Heimbigner)
introduced an adatcl package which gives Ada programmers access to Tcl
interpreters.  (See "part4") for details of the package.

F. Perl

	In the past, efforts by Dov Grobgeld
<URL: > and Guenther Schreiner
<URL: > were made to develop at least 2
Perl 4 to Tcl/Tk interfaces.

	More effort has occured in the Perl 5 environment, where an
extension to allow Perl 5 to directly access the Tcl C API, as well as an
extension to allow the ability to do Tk programming without a Tcl
interpreter involved at all are available.  These packages can be ftp'd
from the Comprehensive Perl Archive Network (CPAN) - a series of ftp
sites which keep the latest and greatest archives of Perl code in sync.
See <URL: > for a pointer to CPAN,
and follow the links to find the Tcl related Perl packages.

G. Prolog

	The package ProTcl is an interface between Prolog and Tcl/Tk.
It works best with ECLiPSe, but the foreign interface of SICStus and Quintus
is also provided. The interface is dynamically loaded into a Prolog process
and it gives access to Tcl commands and to handling Tk events. It is also
possible to call Prolog from Tcl, handle Tk events in Prolog and to
pass Prolog variables back to Tcl. See
<URL: > for more details.

H. Other

	A module for Python based on Tk is available - more details are
available in <URL: news:comp.lang.python > on this front.

	Tk bindings for the Dylan language are being shipped as a part
of CMU's Mindy compiler for Dylan.  The Sather language also has a set
of classes to bind in Tk/Tcl.

	Duncan Sinclair <URL: > has details of a
hack into wish.c some hooks for a Tk to any language system, and has been
using it for communication with functional languages such as Haskell and
Lazy ML.  A paper, plus sample code, was available by ftp from
<URL: >.
Unfortunately I've been unable to confirm this is still available.

	The InterLanguage Unification project is a system that promotes
software interoperability via interfaces.  It has the ability to allow
Common Lisp, ANSI C, C++, Modula 3 to interact and plans to add Python,
Tcl, and GNU Emacs-Lisp shortly.

	Of course the Wafe application environment is designed to make
it easier to write GUI applications from within several languages using
Tk as a basis.

	There are several interfaces to allow one to interface with SQL
though some are specific to a database such as Oracle.

	There is an interpreter for Silicon Graphics machines for SGI's
GL language.  There is an interface to WOOL.  The GNU language Guile not
only has a Scheme backend, but a Tcl one as well.  There are at least
two interfaces to Tcl for Java.  There is a Caml Light interface to
Tcl/Tk.  There is a commercial product which provides an interface
between Objective C and Tcl.  There is an interface between Oz and Tcl/Tk.
There is a subset of Modula-3 with a Tk binding.  There is at least one
interface between Scheme and Tk.  There is a binding in Gopher for Tcl/Tk.

	For Java, there is Jacl (a re-implementation of a good part of Tcl
in Java classes) and TclBlend (a Tcl extension allowing a Tcl programmer to
use Java classes as if they were Tcl commands).

	For more details on the above efforts, as well as other
languages, see <URL: >
and (see also "part4").

User Contributions:

Report this comment as inappropriate
May 9, 2018 @ 10:10 am
Les infractions et crimes commis via Internet sont légion. Pour juguler cette cybercriminalité, une coopération internationale et la mobilisation de tous les acteurs sont requises. Les technologies de l'information et de la communication sont les moyens par lesquels les individus mal intentionnés utilisent pour arnaquer les citoyens. Dans le but de lutter activement contre la cybercriminalité, un Centre Européen de Lutte Contre la Cybercriminalité est mis en place par l’Union Européenne. La création de ce centre fait partie des mesures mises en place pour protéger les citoyens contre la criminalité à travers le réseau internet. Ses missions portent notamment sur les différents types de cybercriminalité à savoir escroqueries, fraudes, extorsions, abus, espionnages, arnaques aux sentiments, conflits et harcèlements. Ce centre inauguré depuis le 11 janvier 2013, situé dans les locaux d'Europol (office européen de police), à La Haye aux Pays-Bas a fait des prouesses considérables. En Décembre 2017 plus de 4 millions de personnes parmi ceux qui ont portées plaintes avec des preuves probantes et qui ont collaborées avec les éléments des brigades à l’arrestation des auteurs de ces crimes ont été remboursées et dédommagées, alors nous exhortons tous ceux qui se sont faits arnaqués via internet et qui détiennent des preuves à bien vouloir porter plainte aux adresses suivantes pour l’éradication de ce fléau.

Adresses mails : /

Comment about this article, ask questions, or add new information about this topic:


Top Document: comp.lang.tcl Frequently Asked Questions (March 07, 2005) (1/6)
Previous Document: -III- Do these packages run on my machine?
Next Document: -V- What training material is available?

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer: (Larry W. Virden)

Last Update March 27 2014 @ 02:12 PM