eliaskosunen / libcppffi

C++ bindings over libffi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libcppffi

Build Status Coverage Status

Header-only templated C++ wrapper over the C library libffi

WORK IN PROGRESS. It's buggy and lacks features. There isn't any documentation yet.

Essentially a zero-cost abstraction that gives you strong type-safety.

Example

#include <cppffi.h>
#include <iostream>

int foo()
{
    return 42;
}

void bar(float f)
{
    std::cout << f << '\n';
}

int main()
{
    std::cout << ffi::call(foo) << '\n';
    ffi::call(bar, 3.14f);

    ffi::cif<int()> foo_cif;
    auto foo_call = foo_cif.bind(foo);
    std::cout << foo_call() << '\n';
}

License

libcppffi is licensed under the MIT license.

Copyright 2017 Elias Kosunen

About

C++ bindings over libffi

License:MIT License


Languages

Language:C++ 83.4%Language:CMake 13.5%Language:C 3.2%