A higher-level class for loading dynamic libraries and resolving symbols in Crystal.
Add this to your application's shard.yml
:
dependencies:
dynamic-library:
github: hyronx/dynamic-library
require "dynamic-library"
library = DynamicLibrary.new "some_lib.so", LibC::RTLD_NOW
if symbol = library.symbol? "add"
func = Proc(UInt32, UInt32, UInt32).new symbol, Pointer(Void).null
func.call(1, 2) # -> 3
end
# library.close (This is optional and otherwise automatically done.)
- Fork it ( https://github.com/hyronx/dynamic-library/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- hyronx - creator, maintainer