On Thu, Dec 18, 2014 at 11:29 AM, Justin M Wozniak <wo...@mc...> wrote:
> Hi
> I am trying to get basic calls from Tcl to Java working with recent
> Tcl and Java. I was able to make some minor changes to get things close
> to working but am stumped with the issue pasted below. Does anyone have
> a hint why TclBlend would stop working inside a Tcl for loop?
I would check if the java0x1 command is still available after the 'if
true ....'.
There is certainly something hinky going on which causes the command
to be deleted.
As I do not really know TclBlend/TclJava at all, I can't really say
what is going on exactly.
The Tcl code in itself looks ok to me.
You might have to add (more) C-level instrumentation to see where it
goes off the rails.
I would guess that when the command is created, i.e. in java::new, a
deletion callback is also set, for proper cleanup of the command's
resources. Instrumenting that, possibly even forcing a core dump
(assert (0)) could then help in figuring out where the system is. If
there is no deletion callback I would advise to create and set your
own, just for instrumentation.
> Thanks!
>
> package require java
> set s [ java::new String "STRING" ]
> puts "s: $s"
> puts [ info commands ]
> set i 2
> puts "charAt: [ $s charAt $i ]"
> puts "charAt: [ $s charAt $i ]"
> if true {puts [ $s charAt $i ] }
> for { set i 0 } { $i < 1 } { incr i } { puts [ $s charAt $i ] }
>
> results in:
>
> javaInterp.c: interp: 0xa0fd60 createCommand: java::new
> javaInterp.c: interp: 0xa0fd60 createCommand: java0x1
> s: java0x1
> ... java0x1 ...
> TCLBLEND_DEBUG: JavaCmdProc(java0x1)
> charAt: R
> TCLBLEND_DEBUG: JavaCmdProc(java0x1)
> charAt: R
> TCLBLEND_DEBUG: JavaCmdProc(java0x1)
> R
> invalid command name "java0x1"
> while executing
> "$s charAt $i "
> ("for" body line 2)
> invoked from within
> "for { set i 0 } { $i < 1 } { incr i } {
> puts [ $s charAt $i ]
> }"
>
>
> --
> Justin M Wozniak
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> tcljava-dev mailing list
> tcl...@li...
> https://lists.sourceforge.net/lists/listinfo/tcljava-dev
--
Andreas Kupries
Senior Tcl Developer
Code to Cloud: Smarter, Safer, Faster™
F: 778.786.1133
and...@ac..., http://www.activestate.com
Learn about Stackato for Private PaaS: http://www.activestate.com/stackato
|