ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcljava-user
tcljava-user
Re: [tcljava-user] Tcl Extension
by Mo DeJong other posts by this author
Feb 6 2006 6:22PM messages near this date
[tcljava-user] Tcl Extension | RE: [tcljava-user] Tcl Extension
On Mon, 6 Feb 2006 13:40:10 -0700
"Pierce, Greg" <Greg.Pierce@[...].com>  wrote:

>  Hi,
>   
>  I'm using TclBlend within a Java application to add scripting
>  capabilities.
>   
>  I have a C/C++ based Tcl Extension that I've developed and want to use
>  within a Tcl_Interp. I'm able to do a 'package require' of my Tcl
>  Extension
>   
>  Tcl_Interp interp;
>  interp.eval("package require Myext");
>  interp.eval("mycmd");
>   
>  but when the extension tries to execute a Tcl C API command like
>  Tcl_AppendResult within 'mycmd' it
>  crashes with an error like:
>   
>  alloc: invalid block: 0xb03be3e0: 1 0 0
>  
>  Does anyone know why this is happening?
>   
>  I've done some research on this alloc command error and what I've found
>  is that
>  it might be related to Tcl Threads. I need to make my application
>  "Thread-Safe".
>  Is this because TclBlend uses Threads?

Yes, Tcl Blend needs to be used with a thread safe build of Tcl. Your extension
also needs to be built with the same version of Tcl so that it makes use of thread
safe APIs.

>  Question: Why does TclBlend need to use threads?

Because Tcl Blend interacts with Java and Java is multi threaded. This means that
thread safe APIs needs to be used in all the code running in your process. Here is
a link that describes how to build Tcl and Tcl Blend so that they are thread safe.
You should try recompiling your extension with the thread safe version of Tcl
you built and see if that helps. You might also check the CFLAGS being used
when your extension is compiled to make sure the proper flags are being passed
on the compiler command line.

http://wiki.tcl.tk/9993

cheers
Mo DeJong


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
tcljava-user mailing list
tcljava-user@[...].net
https://lists.sourceforge.net/lists/listinfo/tcljava-user
Thread:
Greg Pierce
Mo DeJong
Greg Pierce
Greg Pierce
Greg Pierce

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved