w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
tclshcpp.cpp
Go to the documentation of this file.
1// $Id: tclshcpp.cpp 1185 2019-07-12 17:29:12Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2014- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2014-11-07 601 1.0 Initial version
8
9// This code is the minimal code for a tclsh, as recommended by
10// http://wiki.tcl.tk/1315
11// but also equivalent to the code in tclAppInit.c which is the source of
12// tclsh when all ifdefs and options have been removed.
13//
14// Only difference to the plain C version is the inclusion of <iostream>.
15// This ensures that the C++ basing I/O streams are initialized before the
16// Tcl interpreter starts.
17//
18// If iostream is not included one gets core dumps when a 'package require'
19// loads a dynamic library which has C++ code and unresolved references.
20// With iostream included one gets a proper error message.
21//
22
23#include "tcl.h"
24#include <iostream>
25
26int main(int argc, char **argv)
27{
28 extern int Tcl_AppInit(Tcl_Interp *interp);
29 Tcl_Main(argc, argv, Tcl_AppInit);
30 return 0;
31}
32
33int Tcl_AppInit(Tcl_Interp *interp)
34{
35 if (Tcl_Init(interp) == TCL_ERROR) return TCL_ERROR;
36 Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY);
37 return TCL_OK;
38}
int main(int argc, char **argv)
Definition: tclshcpp.cpp:26
int Tcl_AppInit(Tcl_Interp *interp)
Definition: tclshcpp.cpp:33