1 Jun 2004 01:07
Reseting swigCMemOwn inside a method
<camelo <at> hoplon.com>
2004-05-31 23:07:55 GMT
2004-05-31 23:07:55 GMT
Hi!
<< Sorry if you get a duplicate copy of this message. My first
attempt didn't got through. >>
I`m trying to reset the swigMemOwn flag of an object after it has
been passed to a method that aquires ownership of its parameter.
I'm trying to use a javain typemap, but I confess I haven't got the
grip of typemaps. For our python bindings, I`m using the following
syntax (borrowed from a previus post I've found in the archives):
%typemap(python,in) core::ServerUniverseObject *p_obj_ptr {
if ((SWIG_ConvertPtr(obj1,(void **) &arg2,
SWIGTYPE_p_core__ServerUniverseObject,SWIG_POINTER_EXCEPTION | 0 )) ==
-1) SWIG_fail;
PyObject_SetAttrString( $input, "thisown", PyInt_FromLong((long)0) );
}
In java I'd like to do something like this:
%typemap(javain) core::ServerSyncObject *p_obj_ptr {
corelibsjJNI.ServerUniverseData_addSyncObject(swigCPtr, p_obj_ptr);
p_obj_ptr.swigCMemOwn = false;
}
But the resulting wrapper code is rather strange to me:
public void addSyncObject(ServerSyncObject p_obj_ptr) {
(Continue reading)
RSS Feed