D is a new programming language designed as an evolution of C/C++. The language specification is currently at http://www.digitalmars.com/d/index.html ---- We can call Tcl from D fairly simply. In fact, it looks a ''lot'' like C++ in most places. The main issue is to generate an import symbol file for the Tcl API (which can be done by using the genStubs script file). Under windows I had to convert the standard ActiveState tcl83.lib to an OMF format library. To do this we convert the to COFF format using Microsoft's LINK program and then Digital Mars' COFF2OMF utility link /lib /convert tcl83.lib coff2omd tcl83.lib To illustrate, here is an initial stab. Build this using dmd simple.d tcl83.lib ---- // simple.d - Copyright (C) 2003 Pat Thoyts // // Demonstrate linking to Tcl from the D programming language. // See http://www.digitalmars.com/d/index.html for information // about ``D'' // // $Id: 6261,v 1.1 2003-01-14 09:01:53 jcw Exp $ import c.stdio; import stream; import compiler; // ---------------------------------------------------------------------- // Define the bits we need for interfacing to Tcl API // extern (C) { alias void* ClientData; alias void (*Tcl_FreeProc)(char* blockPtr); alias void (*Tcl_CmdDeleteProc)(ClientData clientData); alias int (*Tcl_CmdProc)(ClientData clientData, Tcl_Interp * interp, int argc, char* argv[]); alias void* Tcl_Command; struct Tcl_Interp { char* result; Tcl_FreeProc blockPtr; int errorLine; } enum { TCL_OK = 0, TCL_ERROR = 1, TCL_RETURN = 2, TCL_BREAK = 3, TCL_CONTINUE = 4, } enum : Tcl_FreeProc { TCL_VOLATILE = (Tcl_FreeProc)1, TCL_STATIC = (Tcl_FreeProc)0, TCL_DYNAMIC = (Tcl_FreeProc)3, } export { Tcl_Interp* Tcl_CreateInterp(); Tcl_Command Tcl_CreateCommand(Tcl_Interp * interp, char * cmdName, Tcl_CmdProc proc, ClientData clientData, Tcl_CmdDeleteProc deleteProc); int Tcl_Eval(Tcl_Interp * interp, char * string); int Tcl_EvalFile(Tcl_Interp * interp, char * fileName); char * Tcl_GetStringResult(Tcl_Interp* interp); void Tcl_SetResult(Tcl_Interp * interp, char * str, Tcl_FreeProc freeProc); } } // ---------------------------------------------------------------------- int main(char[][] args) { Tcl_Interp* interp; interp = Tcl_CreateInterp(); Tcl_CreateCommand(interp, "ddemo", &DDemoCmd, (ClientData)null, (Tcl_CmdDeleteProc)null); int r; if (args.length < 2) { r = Tcl_Eval(interp, "puts \"Tcl version: [info tcl]\"; ddemo"); } else { int r = Tcl_EvalFile(interp, args[1]); } printf(Tcl_GetStringResult(interp)); return r; } // Add a new command to the Tcl interpreter. // In this case: return some information about the D compiler. extern (C): int DDemoCmd(ClientData clientData, Tcl_Interp *interp, int argc, char* argv[]) { MemoryStream stm = new MemoryStream; stm.printf(compiler.name); stm.printf(" %d.%d", compiler.version_major, compiler.version_minor); Tcl_SetResult(interp, stm.toString(), TCL_STATIC); return TCL_OK; } // ---------------------------------------------------------------------- // // Local variables: // mode: c // compile-command: "dmd d_test1.d ole32.lib uuid.lib" // End: