« Return to Thread: Another reference problem

Another reference problem

by MD-16 :: Rate this Message:

Reply to Author | View in Thread

Hi,

I've a problem passing a Python object to a method that expects a
reference value, I read lots of previous messages but I couldn't find
one that fit my situation so here is my problem:

Python class:

import mymodule as mm
class PyFoo(mm.Foo): pass
class PyBar(mm.Bar): pass

pf = PyFoo()
pb = PyBar()
pb.test(0, pf) # the problem manifests here

Foo and Bar are C++ classes and Bar::test has the following signature:

void test(my_enum_type, Foo&);

The error message I have is:
TypeError: "in method Bar_test, argument 3 of type 'Foo &'"

I tried to define a typemap like this:
%typemap(directorin) (my_enum_type et, Foo &foo) {
        $1 = et;
        $2 = &foo;
}

but it looks like it's not taken into account.
What should I do more ?

Thanks,
MD

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

 « Return to Thread: Another reference problem