• Compiling for Tcl 9

    From meshparts@alexandru.dadalau@meshparts.de to comp.lang.tcl on Sat Aug 30 17:31:22 2025
    From Newsgroup: comp.lang.tcl

    Hi there,

    I'm trying to compile an extension for Tcl 9, freshly moving from Tcl 8.

    Before that, I was using this command to compile:

    gcc meshparts.c -shared -o C:/Users/public/ meshparts.dll
    -DUSE_TCL_STUBS -IC:/Tcl/include -LC:/Tcl/lib -ltclstub86 -O3

    I can't manage to make this work with Tcl 9 by changing the option
    -ltclstub86 to -ltclstub (since I see there is a tclstub.lib in that directory):

    gcc meshparts.c -shared -o C:/Users/public/ meshparts.dll
    -DUSE_TCL_STUBS -IC:/Tcl/include -LC:/Tcl/lib -ltclstub -O3

    Any help much appreciated.

    Thanks
    Alexandru
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From meshparts@alexandru.dadalau@meshparts.de to comp.lang.tcl on Sat Aug 30 17:35:06 2025
    From Newsgroup: comp.lang.tcl

    Am 30.08.2025 um 17:31 schrieb meshparts:
    Hi there,

    I'm trying to compile an extension for Tcl 9, freshly moving from Tcl 8.

    Before that, I was using this command to compile:

    gcc meshparts.c -shared -o C:/Users/public/ meshparts.dll -
    DUSE_TCL_STUBS -IC:/Tcl/include -LC:/Tcl/lib -ltclstub86 -O3

    I can't manage to make this work with Tcl 9 by changing the option - ltclstub86 to -ltclstub (since I see there is a tclstub.lib in that directory):

    gcc meshparts.c -shared -o C:/Users/public/ meshparts.dll -
    DUSE_TCL_STUBS -IC:/Tcl/include -LC:/Tcl/lib -ltclstub -O3

    Any help much appreciated.

    Thanks
    Alexandru

    Actually, there are no errors when compiling with the above command.
    Just no DLL is created.

    I get a lot of warnings like this:

    In function 'VectorsSum_Cmd':
    meshparts.c:3349:35: warning: passing argument 3 of 'tclStubsPtr->tcl_ListObjLength' from incompatible pointer type [-Wincompatible-pointer-types]
    Tcl_ListObjLength(ip, objv[1], &vlen);


    Those warnings are new, did not happen with Tcl 8.

    Here are the corresponding lines of code:

    static int
    VectorsSum_Cmd (ClientData cdata, Tcl_Interp *ip, int objc, Tcl_Obj
    *const objv[]) {
    // objv[1] vector
    // objv[2] vector
    Tcl_Obj *listElemPtr, **objCoeff;
    int i, vlen;
    Tcl_ListObjLength(ip, objv[1], &vlen);


    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Christian Gollwitzer@auriocus@gmx.de to comp.lang.tcl on Sat Aug 30 18:55:25 2025
    From Newsgroup: comp.lang.tcl

    Am 30.08.25 um 17:35 schrieb meshparts:
    Am 30.08.2025 um 17:31 schrieb meshparts:

    gcc meshparts.c -shared -o C:/Users/public/ meshparts.dll -
    DUSE_TCL_STUBS -IC:/Tcl/include -LC:/Tcl/lib -ltclstub -O3


    Actually, there are no errors when compiling with the above command.
    Just no DLL is created.

    I get a lot of warnings like this:

    In function 'VectorsSum_Cmd':
    meshparts.c:3349:35: warning: passing argument 3 of 'tclStubsPtr-
    tcl_ListObjLength' from incompatible pointer type [-Wincompatible- pointer-types]

    Others may chime in on the warnings. I guess you need to update the
    code. Probably instead of int vlen, Tcl_Size vlen or similar.

    However, a warning does not prevent the DLL from being created. Are you
    sure there is no error at the end?

    One thing that seems strange to me is the space between the path and the filename in "-o C:/Users/public/ meshparts.dll"

    Is it copy-pasted? -o expects the output file name, which is now a
    directory (this does not work) and meshparts.dll is treated as an input
    file to link against.

    Christian

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From meshparts@alexandru.dadalau@meshparts.de to comp.lang.tcl on Sat Aug 30 20:41:09 2025
    From Newsgroup: comp.lang.tcl

    Am 30.08.2025 um 18:55 schrieb Christian Gollwitzer:
    Am 30.08.25 um 17:35 schrieb meshparts:
    Am 30.08.2025 um 17:31 schrieb meshparts:

    gcc meshparts.c -shared -o C:/Users/public/ meshparts.dll -
    DUSE_TCL_STUBS -IC:/Tcl/include -LC:/Tcl/lib -ltclstub -O3


    Actually, there are no errors when compiling with the above command.
    Just no DLL is created.

    I get a lot of warnings like this:

    In function 'VectorsSum_Cmd':
    meshparts.c:3349:35: warning: passing argument 3 of 'tclStubsPtr-
    tcl_ListObjLength' from incompatible pointer type [-Wincompatible-
    pointer-types]

    Others may chime in on the warnings. I guess you need to update the
    code. Probably instead of int vlen, Tcl_Size vlen or similar.

    However, a warning does not prevent the DLL from being created. Are you
    sure there is no error at the end?

    One thing that seems strange to me is the space between the path and the filename in "-o C:/Users/public/ meshparts.dll"

    Is it copy-pasted? -o expects the output file name, which is now a
    directory (this does not work) and meshparts.dll is treated as an input
    file to link against.

    -a-a-a-a-a-a-a-a-a-a-a-a Christian

    Oh, I though I deleted this message but I'm new to Thunderbird.
    Thanks for replying. In the meantime Paul Obermeier helped me.
    The issue was that some Tcl_* functions now return Tcl_Size instead of int.
    --- Synchronet 3.21a-Linux NewsLink 1.2