项目作者: eliaskosunen

项目描述 :
C++ bindings over libffi
高级语言: C++
项目地址: git://github.com/eliaskosunen/libcppffi.git
创建时间: 2017-03-29T12:36:01Z
项目社区:https://github.com/eliaskosunen/libcppffi

开源协议:MIT License

下载


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

  1. #include <cppffi.h>
  2. #include <iostream>
  3. int foo()
  4. {
  5. return 42;
  6. }
  7. void bar(float f)
  8. {
  9. std::cout << f << '\n';
  10. }
  11. int main()
  12. {
  13. std::cout << ffi::call(foo) << '\n';
  14. ffi::call(bar, 3.14f);
  15. ffi::cif<int()> foo_cif;
  16. auto foo_call = foo_cif.bind(foo);
  17. std::cout << foo_call() << '\n';
  18. }

License

libcppffi is licensed under the MIT license.

Copyright 2017 Elias Kosunen