Share_ PTR is used with swig directors for Java

I began to understand swig. It seems that the latest version of swig (V3.0) can only handle all the contents I use out of the box, including C 11 functions, but when it comes to it, I have trouble sharing_ PTR is used with my director class

I've been able to make shared_ PTR works with general proxy classes, but now in my director, it doesn't seem to support out of the box It gives me automatically generated types, such as swigtype_ p_ std__ shared_ ptrT_ MyDataType_ t. And is generating a corrupted interface because it does not use the same type used by the proxy class

I have a simple example of what I'm trying to do (run swig - C – java test. I on swig 3.0):

Test. i

%module(directors="1") test
%{

%}

%include <std_shared_ptr.i>

%shared_ptr(MyDataType)

class MyDataType {
public:
    int value;
};

class NonDirectorClass {
public:
    std::shared_ptr<MyDataType> TestMethod();
};

%feature("director") CallbackBaseClass;

class CallbackBaseClass {
public:
    virtual ~CallbackBaseClass() {};
    virtual std::shared_ptr<MyDataType> GetDataFromJava() {};
};

Basically, what I want to do is to extend callbackbaseclass in Java. I hope to pass my shared_ PTR packaging type Non director class generates shared_ PTR type is good The director class proxy file was generated correctly, but the swigdirector in the wrapper_ Method references the wrong type

It looks like I can put swigtype anywhere_ p_ std__ shared_ ptrT_ MyDataType_ Change the type of t to mydatatype to repair the file manually, but I hope people with more swig knowledge can answer this question so that it can be generated correctly

I have the best clue here, but I'm still trying to figure out how to use these types of maps correctly, especially for shared_ PTR is not a basic primitive

to update:

File says:

Although it does not explain the reason If there are good reasons not to use shared among directors_ PTR, I want to know that this is impossible for swig director It seems to make sense to use the same type you use elsewhere I hope the answer is possible

Solution

The latest version of the swig document is now:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>