-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crystal_lib_gen #2
Comments
Wow, that's AWESOME!! I followed the README instructions and it worked flawlessly :-) I think that eventually we'll want a tool like this to be integrated in the compiler (or at least as a companion to the main binary) because it will make it so much easier to write C bindings. So preferably we would have this written in Crystal, but for now it's really, really good to have this and we will definitely use it and encourage others to use it until we get to the point when it is written in Crystal. Just a small thing: I tried to run it with libuv and I get an FFIGen.generate(
module_name: "LibUV",
ffi_lib: "libuv",
headers: %w[
uv.h
],
cflags: ['-I/usr/local/opt/libuv/include/'],
prefixes: [],
output: "out/libuv.cr"
) And I installed it with And a request: I tried to put "git" on the list of prefixes and it generated the functions like this: @[Link("libgit2")]
lib Git2
fun repository_open(out : Void**, path : UInt8*) : Int16
end Would it be possible to generate this instead: @[Link("libgit2")]
lib Git2
fun repository_open = git_repository_open(out : Void**, path : UInt8*) : Int16
end Because the Again, thanks! |
You're right! Prefix support added. This should work to all possibile function names.
|
I have to look at libuv, this one not work. |
That was fast! Thanks! |
Here is my quite working tool for generating C bindings in Crystal
Written in ruby, based on gen_ffi gem.
https://github.com/fazibear/crystal_lib_gen
Hope you like it :)
The text was updated successfully, but these errors were encountered: