From: killy-kun Date: 2006-03-20T22:43:49+09:00 Subject: swig, c++, use string I would like to use the c++ string type as a parameter of function return of some c++ functions used in a ruby module, made with swig. Here is a simple example I tried to use the string type : #----------------- %module str %inline %{ // pour tester les string #include using namespace std; string fctBidon (string s) { string res; res = s + " salt bidon"; return res; } string bidon() { string res = "bouh"; return res; } %} #----------------- But when I use it, here are the errors I get : #----------------- [eurubyt:24] bidon ==> # [eurubyt:25] bidon.class ==> SWIG::TYPE_p_string [eurubyt:26] fctBidon("bb") TypeError: in method 'fctBidon', argument 1 of type 'string' from (irb):26:in `fctBidon' from (irb):26 #----------------- That means the c++ string type isn't considered as the ruby String class... Anybody knows how I can make this work ? I would like the c++ string type to be considered as the ruby String class...