Subject:
[ruby-ffi] Best way to handle constants
From:
Maurizio De Santis
Date:
10/15/13 4:58 AM
To:
ruby-ffi@googlegroups.com

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:

    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.

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.