Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

eliaskosunen/libcppffi

Repository files navigation

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

Releases

No releases published

Packages

No packages published