Hi,
I'm not sure it's a bug of TclApp, but it troubles me, and I can't get it over. I need help. Thank you.
My program gets "Runtime error" and breaks down using Tcl_SetObjResult,
The detailed information is "Microsoft Runtime Library: This
application has requested the Runtime to terminate it in an unusual
way. Please contact the application's support team for information."
It have some .tcl scripts and a DLL which is compiled with MS VC++6.0.
The DLL returns TCL_ERROR or TCL_OK to tcl script using Tcl_SetObjResult. It works well with Wish, but when I wrap it to .exe with TclApp in TDK4.0.4, it runs into the error described above.
Here's a sample for reference.
Tcl script:
package require Tk
button .btn -text "check" -command {
load sample.dll
.btn configure -text [check]
}
pack .btn
C code in sample.dll:
----------------------------------------------------------------
#include
#include
#include "tcl.h"
#pragma comment (lib, "tcl84.lib")
#define EXPORT _declspec(dllexport)
EXTERN_C static int check(ClientData clientData, Tcl_interp *interp,
int objc, Tcl_Obj* CONST objv[])
{
int ret = 0;
Tcl_Obj *rtnVal = NULL;
if(ret == 1)
{
rtnVal = Tcl_NewIntObj(TCL_OK);
}
else
{
rtnVal = Tcl_NewIntObj(TCL_ERROR);
}
Tcl_SetObjResult(interp, rtnVal);
return TCL_OK;
}
EXTERN_C static int Sample_Init(Tcl_interp *interp)
{
Tcl_CreateObjCommand(interp, "check", check, NULL, NULL);
return TCL_OK;
}
--------------------------------------------------------------
Regards
ZhouJingyu
http://bugs.activestate.com/show_bug.cgi?id=82082
Please post to a single forum for answers to avoid the repeat effort of response.