Compiling GTK4 in windows with Vulkan

Submitted by Dickens A S on Sat, 12/07/2019 - 10:06

GTK4 is already available for download as "mingw-w64-x86_64-gtk4" you can type "pacman -S mingw-w64-x86_64-gtk4" to install it

Below steps are useful if you want to customize and install GTK4 with vulkan

Step 1 download and install MSYS2

Step 3 Install toolchains

GTK4 + GSK Cairo / Vulkan

Submitted by Dickens A S on Sat, 12/07/2019 - 09:52

Cairo is a ancient 2D library to draw shapes on linux platform.

It can be used in windows with proper library DLL extensions.

There a few software still uses cairo.

This demo kotlin code explains how to render a cairo+graphene rectangle region using GSK

Kotlin Code

Kotlin AVR Atmega8 [Experimental]

Submitted by Dickens A S on Mon, 12/02/2019 - 17:17

This is a small experiment for AVR Atmega8 

A simple swap function which is possibly re-used inside actual avr "C/C++" code as library

import platform.avr.*
import kotlinx.cinterop.internal.*
import kotlinx.cinterop.*

fun swap(a:uint8_tVar, b:uint8_tVar) = memScoped {
    var temp = a
    a.value = b.value
    b.value = temp.value
}

Install mingw64 dependencies as below

GLEW + GTK3 using Kotlin [Experimental]

Submitted by Dickens A S on Sun, 12/01/2019 - 17:59

This is an experimental code with few glitches

it allows Cygwin+Mingw to use GTK3 from cygwin to render opengl GLEW

Kotlin code

GTK3 and Glade3 using Kotlin

Submitted by Dickens A S on Sat, 11/30/2019 - 14:13

GTK windows design using glade builder

This code explains how to use Kotlin to program GTK3 and Glade3 using Cygwin Glade designer

Install cygwin with below dependencies

mingw64-x86_64-gtk3    3.22.28-1
glade                                 3.20.3-1
xorg-server                       1.20.4-1
xinit                                   1.4.1-1

launch cygwin and export the PATH as

Call OpenCL from Kotlin or embed OpenCL inside Kotlin

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

Embedded OpenCL inside Kotlin

OpenCL code which runs from kotlin

#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable
__constant char hw[] = "Hello World";
__kernel void hello(__global char * A) {
    size_t tid = get_global_id(0);
    A[tid] = hw[tid];
}

 

Kotlin code which runs OpenCL

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

Call R from Kotlin or embed R inside Kotlin

Submitted by Dickens A S on Fri, 11/29/2019 - 06:03

Embedded R inside Kotlin

Demo output

E Embed

R code which is running inside Kotlin, simply add number 2 all the incoming array values and return

myfunc <- function(p1) {
  cat("Incoming value from Kotlin: ", p1, "\n");

  return(p1 + 2)
}

The Kotlin code which runs the R

Artificial Neural Network in Kotlin - FANN

Submitted by Dickens A S on Thu, 11/28/2019 - 13:53

FANN is an open source library 

which offers C based API which can be invoked from Kotlin

Below Kotlin example shows how it can be invoked

import fann.*

fun main() 
{

    var ann = fann_create_standard(4, 2, 8, 9, 1)
    
    fann_print_connections(ann)
    
    fann_destroy(ann)
}

Below is the sample output from MSYS2 terminal

Call MATLAB function octave Mex from Kotlin

Submitted by Dickens A S on Thu, 11/28/2019 - 09:06

Is one of the popular Scientific Programming Language or platform

general MATLAB functions will work in Octave

This Article explains how to trigger Mex script from Kotlin using "mex.h" and "octave.h" C API in Kotlin

Octave 5.1.0 is installed in C:\octave with below structure and files

Note: Octave 6.x.x has C++ class will not support Kotlin, Please use Octave 5.1.0