I am trying to build a WPF GUI to control IXIA interface which is written in TCL (IXIA is application which control hardware), TCL version is 86.
For this purpose, I have created the following:
- C# project which consists of
- TCL_API.cs class - contains the tcl DLLs.
- IXIA.cs class - Contains all methods to access IXIA additianlly the
evalScript
method that invoke the TCL_API.cs class which is handle with the TCL commands.
- WPF in visual Studio 2013. With calling methods to IXIA.cs.
The problem is that one of TCL commands get an error "can not find channel named "stdout".
As I found out, its probably happens because this TCL command contains puts
method inside.
I think puts
override can solve this issue but don"t know how to do is as I don"t have entire TCL code but only the DLLs.
See the code:
TclAPI.cs
class TclAPI { [DllImport("tcl86.DLL", CallingConvention = CallingConvention.Cdecl)] public static extern int Tcl_Init(IntPtr interp); [DllImport("tcl86.DLL", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr Tcl_CreateInterp(); [DllImport("tcl86.Dll", CallingConvention = CallingConvention.Cdecl)] public static extern int Tcl_Eval(IntPtr interp, string skript); [DllImport("tcl86.Dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr Tcl_GetObjResult(IntPtr interp); [DllImport("tcl86.Dll", CallingConvention = CallingConvention.Cdecl)] unsafe public static extern char* Tcl_GetStringFromObj(IntPtr tclObj, IntPtr length); }
IXIA.cs constructor:
public IXIA(string ip, string username="admin", string password = "admin") { interp = TclAPI.Tcl_CreateInterp(); TclAPI.Tcl_Init(interp); if (interp == IntPtr.Zero) { throw new SystemException("can not ini tialize Tcl interpreter"); } _ip = ip; _userName = username; _password = password; }
evalScript method in IXIA.cs class:
public int evalScript(string script) { int Evalres = TclAPI.Tcl_Eval(interp, script); return Evalres; }