Interface to C functions on mruby. it's based on libffi.
It's mrbgems.
When you use in your project, please add below to your build_config.rb
.
conf.gem 'path/to/here' do |g|
# g.use_pkg_config # use pkg-config for libffi linking
# g.download_libffi # download and link latest libffi
# if your libffi is installed in a non standard path
# g.cc.include_paths << '[...]/include'
# g.linker.library_paths << '[...]/lib'
end
If you want to run tests, please run below command.
make test
To compile on windows you have to provie dlfcn-win32 libraray.
- install ruby from rubyinstaller.org - get newest with devkit, 64bit
- after installing run as admin:
ridk install 1 2 3
- run msys2 console & install library:
pacman -S mingw-w64-x86_64-dlfcn
- active ridk ruby build system by adding at the top of you Rakefile line:
ruby RubyInstaller::Runtime.enable_msys_apps
- then add to your build_config.rb - to build libffi & link it staically:
MRuby::Build.new do |conf|
toolchain :gcc
conf.gem mgem: "cfunc" do |gem|
gem.download_libffi
gem.linker.flags << "-static"
end
# ... rest of build_config.rb
end
- now you can build mruby with cfunc mgem! :)
- Test!
- Improve error handling
- Support anonymous struct
- Examples
- Documents
Feel free to open tickets or send pull requests with improvements. Thanks in advance for your help!
Original Authors "MobiRuby developers" are https://github.com/mobiruby/mobiruby-ios/tree/master/AUTHORS
See Copyright Notice in cfunc.h.