On Fri, 21 Jan 2005 07:10:58 +0900, Florian Gross <flgr / ccan.de> wrote: > Simon Strandgaard wrote: > > > I am wrapping ncursesw for ruby. > > In ncurses.h it has declared the following variable: > > extern int COLORS; > > > > I would like to access COLORS from ruby (if possible). > > I have tried extern 'int COLORS' but without luck. > > Does this work? > > module MyLib > extend DL::Importable > dlload "ncurses.so" > > Colors = symbol "COLORS" > end No, it seems to return a PtrData instance. I have made something that seems to work.. feels ackward though. I can now access Curses.COLORS and Curses.ESCDELAY. module Curses extend DL::Importable dlload 'libncursesw.so' Int = struct ["int value"] COLORS_PTR = symbol 'COLORS' ESCDELAY_PTR = symbol 'ESCDELAY' def self.COLORS Int.new(COLORS_PTR).value end def self.ESCDELAY Int.new(ESCDELAY_PTR).value end end Im curious to if this can be done smarter? -- Simon Strandgaard