Hello,
I'm writing a wrapper for libgtop2 using ruby-ffi. I would like to read some constants (mainly version, in order to warn the user about having installed the right version). I have some doubts:
- FFI::ConstGenerator seems to be not so popular between projects using ffi. I'm trying to use it and I found that probably its disadvantage is that you have to specify cppflags in order to make it work; for example on my machine I have to use it in this way to make it work:
cg = FFI::ConstGenerator.new('libgtop-2.0', cppflags: '-I/usr/include/libgtop-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include') do |gen|
gen.include 'glibtop.h'
gen.const(:LIBGTOP_MAJOR_VERSION)
gen.const(:LIBGTOP_MINOR_VERSION)
gen.const(:LIBGTOP_MICRO_VERSION)
end
puts cg.to_ruby
It seems to me that cppflags value is strongly dependent from the environment (OS and user customizations). Maybe reading LD configurations could help, but I'm not skilled in C-C++ management, so I'm pretty unsure about it.
- Are there any other advantages/disadvantages I didn't consider? Do you have suggestions about how to mitigate these issues, or alternatives to FFI::ConstGenerator?
Thank you
--
---
You received this message because you are subscribed to the Google Groups "ruby-ffi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-ffi+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.