Ruby/DL - assigning to global variables?
I know I can do:
@@bar = symbol 'bar'
where 'bar' is a variable in libquux. How do I assign a value to bar?
Specifically, I am trying to use libreadline via Ruby/DL (yes, I know
about ext/readline) and am trying to assign a callback to
Re: Ruby/DL - assigning to global variables?
> module Foo
> extend DL::Importable
> dlload 'libquux.so'
> @@bar = symbol 'bar'
> where 'bar' is a variable in libquux. How do I assign a value to bar?
@@bar is considered as a pointer to a value. If its type is int, you can assign
an integer value as follows.
IntValue = struct ["int value"]
obj = IntValue.new(@@bar)
obj.value = 1
Takaaki Tateishi <firstname.lastname@example.org>
|All times are GMT. The time now is 12:24 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.