admin管理员组文章数量:1334887
I have several c++ files & classes under different namespaces that are compiled to the same dll and I want to create corresponding C# API via SWIG interfaces.FileCPP1:
namespace First
{
class MyClass1 {
public:
MyClass1() = default;
void HelloWorld(const std::string& msg) { cout << "Hello World!" << msg << endl;}
};
}
FileCPP2:
namespace Second {
class MyClass2 {
public:
MyClass2() = default;
void HelloWorldAgain(const std::string& msg) { cout << "Hello World again!" << msg << endl;}
};
}
I tried to do: MyClass1.i file:
%include "std_string.i"
%typemap(csclassmodifiers) First::MyClass1
namespace First {
class MyClass1 {
MyClass1();
void HelloWorld(const std::string& msg);
};
}
build line: swig.exe -c++ -csharp -DSWIG2_CSHARP -outdir CSFolder -namespace First -module Base
MyClass2.i file:
%include "std_string.i"
%typemap(csclassmodifiers) Second::MyClass2
namespace Second{
class MyClass2 {
MyClass2();
void HelloWorldAgain(const std::string& msg);
};
}
build line: swig.exe -c++ -csharp -DSWIG2_CSHARP -outdir CSFolder -namespace Second -module Base
Base.i file:
%module Base
%include "MyClass1.i"
%include "MyClass2.i"
build line:
swig.exe -c++ -csharp -DSWIG2_CSHARP -outdir CSFolder
I expect to get in BasePINVOKE.cs file that contains invoke methods from both MyCalss1 and MyClass2, but after build I get randomly only one of those classes invoke methods. All other files are generated as expected. The same happens when I replace "include" with "import". Some ideas what I do wrong?
Try to create SWIG interface of several ".i" that are belong to same dll and different namespace in each file.
本文标签: Build several SWIG interface files under same moduleStack Overflow
版权声明:本文标题:Build several SWIG interface files under same module - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742374270a2462843.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论