type converting C++ std::map into PHP using SWIG -
i have php extension in c++ , used swig wrap it. trying create class implemented in c++ such:
package(const std::map<std::string,std::string> &input_map, const std::queue<std::string> &dates_queue);
in php using script:
<?php require "prq.php"; $input = array("dataset" => "a050119", "station" => "a050119", "flag" => "1"); $dates = array(1 => "read;chunk;2015-07-01 00:00;2015-07-02 00:00"); $package = new package($input, $dates); ?>
but error:
php fatal error: type error in argument 1 of new_package. expected swigtype_p_std__mapt_std__string_std__string_t in /home/jlahowetz2/development/package-request-queue/swig/prq.php on line 230
which makes sense... have no clue how implement std::map in php. looked @ c++ wrapper created swig , found type conversion this:
static swig_type_info _swigt__p_std__mapt_std__string_std__string_t = {"_p_std__mapt_std__string_std__string_t", "std::map< std::string,std::string > *", 0, 0, (void*)0, 0};
my question is: how use type conversion in php pass std::map constructor? thank much.
add
%template(mapstuff) std::map<std::string, std::string>;
to interface file in php treat proxy class.
Comments
Post a Comment