# FixNative Documentation

- Version: 0.2
- Homepage
- ChangeLog

This library allows you to use native APIs.

Features:

- native memory access (including structs)
- calling native functions
- providing native callbacks
- supported systems: Windows, Linux, Mac OS X, Haiku, Raspberry Pi
- supported CPU architectures: x86, x86_64, arm
- support for declaration of structs and functions in C syntax
- licensed under ZLIB license (no attribution required in binary builds)

## 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);
    }

## Classes

- System - information about the system
- Pointer - pointer to arbitrary memory location
  - Memory - pointer to memory with bounds
- StructLayout - computes native layout of a struct
  - UnionLayout - computes native layout of an union
- Library - native library
- Destructor - allows you to add destructors to your objects
- Callback - creation of native callbacks

Global functions
C API