Re: [tcljava-user] Another question
Brought to you by:
mdejong
From: Mo D. <md...@cy...> - 2001-05-16 23:55:42
|
On Tue, 15 May 2001, Tam Huynh wrote: > Please bear with me, i'm just learning this... > I have set my classpath env var for tclblend.jar and tcljava.jar so why ami > i getting this error? My tcl script should be able to call the C function > once it is loaded right? > > Thanks again for any help.. > > public static void main(String args[]) > { > try > { > String myfile = "d:/Tcl83/bin/example.tcl"; > Interp newInterp = new Interp(); > newInterp.eval("load " + "d:/tcl83/lib/example.dll"); > newInterp.evalFile(myfile); > newInterp.dispose(); > } > } > > ERRORS: > > tcl.lang.TclException > tcl.lang.TclException > at tcl.lang.ReturnCmd.cmdProc(ReturnCmd.java) > at tcl.lang.Parser.evalObjv(Parser.java) > at tcl.lang.Parser.eval2(Parser.java) > at tcl.lang.Procedure.cmdProc(Procedure.java) > at tcl.lang.Parser.evalObjv(Parser.java) > at tcl.lang.Parser.evalObjv(Parser.java) > at tcl.lang.Parser.eval2(Parser.java) > at tcl.lang.Interp.eval(Interp.java) > at tcl.lang.Interp.eval(Interp.java) > at Demo1.main(Demo1.java:1003) You need to deal with a return in the calling code, the way Tcl exceptions are mapped to Java exception demand it. Here is a quick snip from src/jacl/tcl/lang/Shell.java. try { interp.evalFile(fileName); } catch (TclException e) { int code = e.getCompletionCode(); if (code == TCL.RETURN) { code = interp.updateReturnInfo(); if (code != TCL.OK) { System.err.println("command returned bad code: " + code); } } else if (code == TCL.ERROR) { System.err.println(interp.getResult().toString()); } else { System.err.println("command returned bad code: " + code); } Mo |