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

GitHubhttps://github.com/dickensas/kotlin-gradle-templates/tree/master/embed-tcl

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

For Python use is code embed python in kolin

For Ruby use this code embed ruby in kotlin

For Lua use this code embed lua in kotlin

For R use this code embed R in kotlin

 

Add new comment