S
SteveD
hey everyone,
im trying to write a script as well as a program each of which can
communicate with one another. the script should be able to have access
to the class in my c++ code. just a simple class with a couple of
variable and some accessors and modifiers for them. i want to be able
to create an object of that class type in the script and call the
classes functions in order to manipulate the data. at this point i can
create an object in the script and it seems that i can modify the object
through the set methods, but when i call the get method for that
function it get an error saying it is expecting the class type as the
return type(i assume thats what the error means.. "in 'getInt': wrong
type - expected DummieClass")
for all of my set methods i return self. for the get methods i return a
VALUE object which should be holding the value of the class member i am
working with.
********************************************************************
c++ code:
static VALUE _wrap_get_int(VALUE self)
{
GET_MY_CLASS(self); //a macro that returns an instance pointer of
my class
//this function call returns a VALUE after converting the c++ int
return GetRubyInt(pDummie->getInt());
}
*********************************************************************
ruby script:
obj = SimpleExt:
ummie.new(12,3.4, "my String")
obj.setInt(100)
x = obj.getInt()
print x
***********************************************************************
it seems to be crashing out when it gets to the line x = obj.getInt().
can anyone tell me whats wrong with this, or am i going about this the
wrong way? im thinking that i may have to change my c++ code around,
but i dont know. if anyone could lend some adive i would appreciate it.
thanks
steveD
im trying to write a script as well as a program each of which can
communicate with one another. the script should be able to have access
to the class in my c++ code. just a simple class with a couple of
variable and some accessors and modifiers for them. i want to be able
to create an object of that class type in the script and call the
classes functions in order to manipulate the data. at this point i can
create an object in the script and it seems that i can modify the object
through the set methods, but when i call the get method for that
function it get an error saying it is expecting the class type as the
return type(i assume thats what the error means.. "in 'getInt': wrong
type - expected DummieClass")
for all of my set methods i return self. for the get methods i return a
VALUE object which should be holding the value of the class member i am
working with.
********************************************************************
c++ code:
static VALUE _wrap_get_int(VALUE self)
{
GET_MY_CLASS(self); //a macro that returns an instance pointer of
my class
//this function call returns a VALUE after converting the c++ int
return GetRubyInt(pDummie->getInt());
}
*********************************************************************
ruby script:
obj = SimpleExt:
obj.setInt(100)
x = obj.getInt()
print x
***********************************************************************
it seems to be crashing out when it gets to the line x = obj.getInt().
can anyone tell me whats wrong with this, or am i going about this the
wrong way? im thinking that i may have to change my c++ code around,
but i dont know. if anyone could lend some adive i would appreciate it.
thanks
steveD