swig 2封送到std :: vector <boost :: filesystem :: path>&从Java到C ++

时间:2019-03-01 16:04:55

标签: java c++ boost stl swig

这是我所拥有的:

%module FacadeInterface

%{
#include <Facade.h>
#include <boost/filesystem/path.hpp>
%}

%typemap(jni) boost::filesystem::path "jstring"
%typemap(jstype) boost::filesystem::path "java.io.File"
%typemap(jtype) boost::filesystem::path "String"
%typemap(javain) boost::filesystem::path "$javainput.toString()"
%typemap(in) boost::filesystem::path (boost::filesystem::path tmp) {
  const char *str = JCALL2(GetStringUTFChars, jenv, $input, 0);
  tmp = str;
  $1 = &tmp;
  JCALL2(ReleaseStringUTFChars, jenv, $input, str);
}

%include "Facade.h"

%include <std_vector.i>
%template(PathsVector) std::vector<boost::filesystem::path>;

这是Facade.h的内容

bool run(const std::vector<boost::filesystem::path> &plyFiles);

在编译Java源代码时,出现以下错误:

/root/build/src/main/com/facade/PathsVector.java:71: error: incompatible types: String cannot be converted to long
    return new SWIGTYPE_p_boost__filesystem__path(FacadeInterfaceJNI.PathsVector_get(swigCPtr, this, i), false);

0 个答案:

没有答案