从C ++/CLI DLL返回本机C ++指针 [英] return Native C++ pointer from C++/CLI DLL
问题描述
大家好
我有一个非常复杂的情况,我将本机C ++指针包装在C ++/CLI类中,然后将其构建到DLL中.当我调用将返回本机指针的GetNode()方法时,会发生以下情况:
I have a very complicated situation, I wrap my native C++ pointer inside a C++/CLI class then I build it into a DLL. when I call my GetNode() method which will return my native pointer the following happen:
1)所有整数,浮点数以及我可以从该本机指针获得的所有内容,但该本机指针中的指针成员除外.
1) all the integer , float , and everything I can get from that native pointer except pointer members within that native pointer.
我做了#pragma make_public(本机指针),但是我只能获取除指针成员之外的所有成员.
I did #pragma make_public ( native pointer) but I can only get all members except pointer member.
我无法访问指针成员的头文件,因为它是通过DLL提供给我的.
I am unable to access the header file of the pointer members because it was given to me in DLL.
任何人都可以帮助我吗? :)我正在使用C ++/CLI
Can anyone help me? :) I am using C++/CLI
谢谢
推荐答案
在本机dll中,指针如何设置为实际数据?在任何C语言程序中,都必须将指针设置为指向实际数据内容.仅加载dll不会将指针设置为实际数据.您的C ++代码必须 执行初始化本地dll中的指针的代码.
In the native dll how does the pointers get set to the actual data? In any C language program pointers have to be set to point to the actual data contents. Just loading the dll will not set the pointersto the actual data. Your C++ code must execute the code that iniailies the pointers in the native dll.
这篇关于从C ++/CLI DLL返回本机C ++指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!