简体   繁体   English

SWIG跨平台

[英]SWIG cross platform

My application is using SWIG to communicate between c++ and python on windows. 我的应用程序使用SWIG在Windows上的c ++和python之间进行通信。

suppose if my interface is "example.h" 假设我的界面是“ example.h”

swig is generating example.py, example_wrap.cxx swig正在生成example.py,example_wrap.cxx

  /* File : example.i */
%module example

%{
#include "example.h"
%}
%include "std_string.i"
%include "std_wstring.i"
%include "example.h" 

I am porting my application to MAC. 我正在将应用程序移植到MAC。 Do i need to generate example.py, example_wrap.cxx on mac? 我需要在Mac上生成example.py,example_wrap.cxx吗? or can i use already generated files ? 或者我可以使用已经生成的文件?

SWIG generates the same code regardless of the platform it is executed on. 不论在什么平台上执行,SWIG都会生成相同的代码。

If any parts of that code are OS/Compiler/etc.-specific (eg calling conventions on Windows for C#), this is handled by conditional compilation for C++ resp. 如果该代码的任何部分是OS / Compiler / etc。特定的(例如,在Windows上为C#调用约定),则由C ++的条件编译处理。 similar techniques in the target language. 目标语言中的类似技术。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM