Call TCL from Kotlin or embed TCL inside Kotlin

Submitted by Dickens A S on Fri, 11/29/2019 - 08:37

Embedded TCL inside Kotlin

TCL code which runs from kotlin

puts "Hello, world!"

Kotlin code which run TCL

package plot

import kotlinx.cinterop.*
import tcl.*

fun main() 
{
    var tcli = Tcl_CreateInterp()
    if(Tcl_Eval(tcli, "set a 1")==TCL_OK) {
        Tcl_EvalFile(tcli, "hello.tcl")
    }
    Tcl_DeleteInterp(tcli)
}

You need to install MSYS2 and tcl using below command

pacman -S mingw-w64-x86_64-tcl mingw-w64-x86_64-tk

Source Code

End Of Article

Add new comment