Does that help?/* lib.i */ % module libspace %{ #include "lib.h" extern x_space * new_space(); extern void destroy_space( x_space * space ); #ifdef PERL_OBJECT #define MAGIC_CLASS _wrap_libspace_var:: class _wrap_libspace_var : public CPerlObj { public: #else #define MAGIC_CLASS #endif SWIGCLASS_STATIC int swig_magic_readonly( pTHX_ SV * SWIGUNUSEDPARM(sv), MAGIC * SWIGUNUSEDPARM(mg) ) { MAGIC_PPERL croak("Value is read-only."); return 0; } #ifdef PERL_OBJECT }; #endif #ifdef __cplusplus extern "C" { #endif XS(_wrap_new_space) { { x_space * result = 0; int argvi = 0; dXSARGS; if ( ( items < 0 ) || ( items > 0 ) ) { SWIG_croak("Usage: new_space();"); } result = ( x_space * ) new_space(); ST(argvi) = SWIG_NewPointerObj( SWIG_as_voidptr(result), SWIGTYPE_p_x_space, 0 | 0 ); argvi++; XSRETURN(argvi); fail: SWIG_croak_null(); } } XS(_wrap_destroy_space) { { x_space * arg1 = ( x_space * ) 0; void * argp1 = 0; int res1 = 0; int argvi = 0; dXSARGS; if ( ( items < 1 ) || ( items > 1 ) ) { SWIG_croak("Usage: destroy_space(space);"); } res1 = SWIG_ConvertPtr( ST(0), &argp1, SWIGTYPE_p_x_sp +ace, 0 | 0 ); if ( !SWIG_IsOK(res1) ) { SWIG_exception_fail( SWIG_ArgError(res1), "in method '" "destroy_space" "', argument " " +1" " of type '" "x_space *""'" ); } arg1 = ( x_space * ) (argp1); destroy_space(arg1); XSRETURN(argvi); fail: SWIG_croak_null(); } } %}
In reply to Re: Perl with Swig C module not releasing memory
by Khen1950fx
in thread [Solved] Perl with Swig C module not releasing memory
by megaframe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |