• Changed Behaviour on Tcl_Alloc in tcl9, howto port ?

    From Michael Niehren@21:1/5 to All on Fri Oct 4 10:54:38 2024
    Hi,

    i am trying to port an C-Module to tcl9. In the module there has been used a call to Tcl_Alloc to allocate memory for an char* variable dest_buf.
    dest_buf = Tcl_Alloc(dest_size);

    Now on tcl9 Tcl_Alloc has an return type of void, on tcl8 it has char*, so i got the error: error: invalid conversion from ‘void*’ to ‘char*’

    I did not find something about that in the migration guide.

    Any ideas for resovling this issue ?

    best regards
    Michael

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Michael Niehren on Fri Oct 4 12:33:35 2024
    Michael Niehren <michael@niehren.de> wrote:
    Hi,

    i am trying to port an C-Module to tcl9. In the module there has been used a call to Tcl_Alloc to allocate memory for an char* variable dest_buf.
    dest_buf = Tcl_Alloc(dest_size);

    Now on tcl9 Tcl_Alloc has an return type of void, on tcl8 it has char*, so i got the error: error: invalid conversion from ‘void*’ to ‘char*’

    I did not find something about that in the migration guide.

    Any ideas for resovling this issue ?

    Possibly casting the void pointer to char*?:

    dest_buf = (char*)Tcl_Alloc(dest_size);

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)