Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/146.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 指向不透明结构的指针的Swig接口定义_C++_C_Binding_Wrapper_Swig - Fatal编程技术网

C++ 指向不透明结构的指针的Swig接口定义

C++ 指向不透明结构的指针的Swig接口定义,c++,c,binding,wrapper,swig,C++,C,Binding,Wrapper,Swig,我目前正在尝试使用SWIG为recostructurmesdk()生成语言绑定。我正在尝试为Python、Java和CSharp生成低级绑定。我试图包装的API是一个普通的C-API,SWIG很好地自动包装了它的大部分部分,除了一个关键部分 ReconstructMeSDK将指向不透明上下文对象的指针声明为 typedef struct _reme_context* reme_context_t; 并提供两个函数,创建新函数或销毁现有函数 // Output a new context rem

我目前正在尝试使用SWIG为recostructurmesdk()生成语言绑定。我正在尝试为Python、Java和CSharp生成低级绑定。我试图包装的API是一个普通的C-API,SWIG很好地自动包装了它的大部分部分,除了一个关键部分

ReconstructMeSDK将指向不透明上下文对象的指针声明为

typedef struct _reme_context* reme_context_t;
并提供两个函数,创建新函数或销毁现有函数

// Output a new context
reme_error_t reme_context_create(reme_context_t *c);

// Destroy existing context and set pointer to null
reme_error_t reme_context_destroy(reme_context_t *c);
ReMe的所有其他功能都将
ReMe\u context\t
对象作为输入。比如说

reme_error_t reme_context_compile(reme_context_t c);
SWIG默认创建两个不可转换的类型:一个用于
reme\u context\t
,另一个用于
reme\u context\t*

我想要实现的是告诉SWIG重新解释
reme_context_t
作为void指针或类似的东西,它可以在所有语言中处理,并在必要时转换为
reme_context_t

例如,在CSharp中,重新解释上述内容的一种自然方式是使用
System.IntPtr
,以便将上述内容转换为

reme_error_t reme_context_create(out System.IntPtr c);
reme_error_t reme_context_destroy(ref System.IntPtr c);
reme_error_t reme_context_compile(System.IntPtr c);
有没有一种简单的方法可以做到这一点,并以SWIG代码处理多种语言的通用方式做到这一点

提前感谢,,
克里斯托夫

有帮助吗?或是柔印。谢谢你的提示。特别是第一个听起来很有趣。我会调查的。