Hi,
Has anybody been able to typemap strings in swig with ruby?
Given the .i file for swig:
%module example
class Test {
public:
string str;
Test() { str = "putz"; }
};
In Ruby:
require 'example'
c = Example::Test.new()
c.str .... returns the following, not "putz"
#<Example::SWIG::TYPE_p_string:0x4029ad64>
In Perl we can add to the .i file the following
%typemap(ruby,out) string {
$target = sv_newmortal();
sv_setpv($target,((char *)$source->c_str()));
argvi++;
}
Any ideas for writing the typemap for strings in ruby or is
there any reference material for swig and ruby on typemaps?
Craig Files