Hi Peter, after few more tests I feel we are getting closer…
Below an excerpt from my very rudimental test program:
int main (int argc ,char *argv[])
{
{
char *my_string;
Tcl_Interp *interp;
my_string = “My_C_String”;
Tcl_FindExecutable(argv[0]);
interp = Tcl_CreateInterp();
Tcl_Init(interp);
(void) Tcl_SetVar(interp, "my_string", my_string, 0);
if (Tcl_EvalFile(interp, "~/mario/tcl/tclfromc.tcl") != TCL_OK) {
fprintf(stderr ,"Tcl_EvalFile error: %s\n" ,
Tcl_GetStringResult(interp));
return EXIT_FAILURE;
}
}
}
It just sets a TCL variable and invokes a one line TCL script (tclfromc.tcl) which looks like this:
puts “Within this Tcl script, my_string has the value ‘$my_string’.”
Compiling and running the C program I get an error message apparently containing garbage.
Tcl_EvalFile error: Ä?Í%À>.È.ÊÁ/À.ÃÑ%Á…~/mario/tcl/tclfromc.tcl…>?.ËÍÄÇ.ÃÑ%Á.?Ê.ÀÑÊÁÄÈ?Ê`
Converting the garbage from EBCDIC to ASCII we can see the reason of the error
Tcl_EvalFile error: couldn’t read file “~/mario/tcl/tclfromc.tcl”: no such file or directory
Recompiling the program with the -qascii option it runs fine:
xlc -qascii -W c,XPLINK -W l,XPLINK -I include -L lib -o tclfromc tclfromc.c -ltcl8.5 -lascii
~/mario/tcl: >./tclfromc
Within this Tcl script, my_string has the value ‘My_C_String’.
I hope this is not the expected behavior as it makes using TCL on z/OS very hard. By the way it also seems inconsistent as it works with ascii parameter strings and ebcdic coded scripts.
Am I missing something? Would it be possible to get a pure ebcdic version?
Thanks in advance,
mario