z/OS Tools & Language

Expand all | Collapse all

Ported Tools - Embedding TCL into my application

  • 1.  Ported Tools - Embedding TCL into my application

    Posted 08-22-2016 03:02

    Hi, I am struggling embedding TCL in a C application. It looks like the provided library is built with the XPLINK option. When I compile my very simple program using xlc under z/OS 2.1

    xlc -W c,XPLINK -W l,XPLINK -I ./include -L ./lib -o tclembed tclembed.c -ltcl8.5

    I get the following binder error messages:

    IEW2456E 9207 SYMBOL _ctype_a UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM
    THE DESIGNATED CALL LIBRARY. NAME SPACE = 3
    IEW2456E 9207 SYMBOL _tolower_a UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM
    THE DESIGNATED CALL LIBRARY. NAME SPACE = 3
    IEW2456E 9207 SYMBOL __read_a UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM
    THE DESIGNATED CALL LIBRARY.
    IEW2456E 9207 SYMBOL __write_a UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM
    THE DESIGNATED CALL LIBRARY.
    IEW2456E 9207 SYMBOL __gethostbyname_OE_a UNRESOLVED. MEMBER COULD NOT BE
    INCLUDED FROM THE DESIGNATED CALL LIBRARY.
    IEW2456E 9207 SYMBOL __gethostbyaddr_OE_a UNRESOLVED. MEMBER COULD NOT BE
    INCLUDED FROM THE DESIGNATED CALL LIBRARY.
    IEW2456E 9207 SYMBOL __getservbyname_OE_a UNRESOLVED. MEMBER COULD NOT BE
    INCLUDED FROM THE DESIGNATED CALL LIBRARY.
    IEW2689W 4C40 DEFINITION SIDE FILE IS NOT DEFINED.

    FSUM3065 The LINKEDIT step ended with return code 8

    Checked the IBM manuals on how to cope with XPLINK but found nothing relevant. Am I missing something / doing something wrong?

    Thanks in advance,
    mario



  • 2.  RE: Ported Tools - Embedding TCL into my application

    Posted 08-23-2016 08:25

    Hi Mario,
    Please take this download and try again. Do let me know if this works for you and I will replace the public download with this new build.

    https://download-eu.rocketsoftware.com/ro2/d/4564610161534870A83CC14BE53BEDCC

    If you need to compile the program with the library tcl8.5.1 this build includes a new script - lib/tclConfig.sh - that must be executed to set compile parameters.

    Regards,
    -Peter



  • 3.  RE: Ported Tools - Embedding TCL into my application

    Posted 08-24-2016 04:08

    Hi Peter,

    thank you for your prompt and kind reply.

    The package you provided fixed the reported issue, allowing me to cleanly compile my sample program.

    I will continue testing in the next days, but I wanted to share the good news.

    Bye for now,
    mario



  • 4.  RE: Ported Tools - Embedding TCL into my application

    Posted 08-27-2016 10:22

    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



  • 5.  RE: Ported Tools - Embedding TCL into my application

    Posted 08-29-2016 14:24

    Greetings, Mario - we are investigating this issue and will post an update soon.

    – Jerry



  • 6.  RE: Ported Tools - Embedding TCL into my application

    Posted 10-13-2016 15:35

    Hello, just wondering if there has been any progress on the subject topic.

    Thank you,
    mario



  • 7.  RE: Ported Tools - Embedding TCL into my application

    Posted 10-18-2016 16:31

    Greetings, Mario. We do not have the resources to investigate this problem further at this time. I have reproduced the problem and saved my notes about it for further investigation, but I unfortunately can’t tell you when that might happen.



  • 8.  RE: Ported Tools - Embedding TCL into my application

    Posted 11-23-2016 09:03

    Mario,

    If you’re interested in embedding scripting languages in C programs I ported Lua to z/OS a while back. Lua is designed from the ground up to be embedded and offers lots of features not available in TCL. The Lua4z port also comes with batteries with a plethora of packages including threads, networking (Sockets, HTTP), json, XML etc http://lua4z.com/.



  • 9.  RE: Ported Tools - Embedding TCL into my application

    Posted 01-09-2017 05:23

    Dave thank you. We needed TCL as it is at the core of SQLite testing framework. Our plan is to build and use SQLite on z/OS, and TCL is required to make sure that new versions of SQLite work fine on z/OS. Unfortunately the ported version of TCL appears completely unusable at the moment. Hope Rocket will find the resources to fix it.



  • 10.  RE: Ported Tools - Embedding TCL into my application

    Posted 01-09-2017 23:59

    Make sense, SQLite is probably the biggest user of TCL these days.

    FWIW, I’ve been using SQLite on z/OS for many years. It’s great! Very easy to build, fast and functionally rich. My Lua port comes with built in support for SQLite in the LuaSQL package, along with DB2/ODBC. For most of my projects I would pick SQLite because all I need is a simple data base without the admin overhead.



  • 11.  RE: Ported Tools - Embedding TCL into my application

    Posted 01-12-2017 06:13

    Dave thank you for your comment, it is interesting. Would you mind sharing your SQLite building options (offline if you prefer).

    We have been trying to create a basic/minimal SQLite configuration by just defining really needed compilation options. We apparently succeeded and SQLite works but we would like to use TCL to make sure we didn’t break anything. In the long term we think TCL would allow us to keep up with new releases making sure our port is still OK.

    In general, current TCL z/OS port with its mixed ASCII / EBCDIC implementation seems useless to me, how can one use it in its current shape?