Converting a C++ String Class to a Python String -


i have c++ class able output strings in normal ascii or wide format. want output in python string. using swig (version 3.0.4) , have read swig documentation. believe need use typemap construct achieve goal. have written following:

%typemap(out) my_namespace::mystring * {   $result = pystring_asstring($1); } 

with no success. when try access c++ string python, following output:

<swig object of type 'mystring *' @ 0x02b6fc68> 

obviously, i'm doing wrong. can point me in right direction? in advance.

i use pyboost c++/python interfaces , amazing , easy that. if can, recommend it. std::string automatically mapped python string. in case, may solution define

__str __

method object or directly pass char* (i see in swig docs never followed way).


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -