FixNative Documentation

This library allows you to use native APIs.

Features:

Declaration in C syntax

You can declare native functions directly in the C syntax. Currently it supports typedefs, structs, common predefined types and functions. The token processor requires using of classes.

An example:

use "native/extern";
use "classes";

import "native/native";

extern "C" {
    typedef struct {
        int some;
        float value;
    } Test;

    bind("lib");
    void some_func(Test *test);
    void other_func();

    bind("c");
    int printf(char *fmt, ...);
}

function test()
{
    Library::bind("c");
    Library::bind("lib", Library::open("./libcustom.so"));

    var test = Test::create();
    test.set_some(5);
    test.set_value(123.0);
    some_func(test);

    printf("Hello, world! value=%f\n", 123.0);
}

JavaScript functions

When using WebAssembly in the browser you can directly embed code of JavaScript functions. Here is an example:

use "native/extern";
use "classes";

import "native/native";

extern "JS" {
    function js_func(arg1: int, arg2: float, arg3: string): float {
        return 123.456;
    }
}

The function declaration must include types for the parameters and the return value (unless there is none). The available types are:

The functions can use these variables:

And these functions:

Classes

Global functions
C API