Foreign Function Interface

I updated the Blaise compiler so it has a Foreign Function Interace (FFI). Earlier this month I modified the compiler so arrays could be made in Blaise, the support I added was more like a hack where the compiler looked for predefined function names. I re-factored the compiler so now it supports a FFI where the compiler now looks for external function declarations. Every time a Blaise programmer uses and function that is declared externally the compiler trusts that the programmer is calling a supported external function.

Here is a snippet of blaise code:

# Here are the external declarations, these tell the compiler which
# functions will be used from an existing library

external Array_make [ typeInfo ] : [ typeInfo ]
external Array_get [ typeInfo ] : [ typeInfo ]

define mn =
    var arr = Array_make(5,1);
    print_int(Array_get(arr, 0))

Leave a Reply