用于包装dll的C ++ / CLI项目 [英] C++/CLI project for wrap a dll

查看:51
本文介绍了用于包装dll的C ++ / CLI项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个Wrapper,我有些疑惑。我不知道如何包装一些方法



首先,我要对类的类型,静态和非静态。非静态类有两个静态方法来获取类的实例并将其销毁。像这样:



I'm writting a Wrapper and I have some doubts. I don't know how to wrap some methods

First, I have to types of classes, static and non static. The non static classes have a two static methods to obtain an instance of the class and destroy it. Like this:

static ThisClass *GetDecoder();
static void DestroyDecoder();





然后有很多方法可以包装,我不知道如何包装下一个:





And then a lot of methods to wrap and I don't know how to wrap the next:

float* GetColorIRTransform();
bool Get3DPointOnIR(double x, double y, double z, bool runDistort, double &irX, double &irY);
DecoderInitStatus InitDecoder(DecoderType decoderType, const char *configFileName, const char *rigFileName, const char *colorRigFile);
Status StartDecoding(VideoStream *pStream, VideoStream *pStreamColor, PointCloud *&pPointCloud);
std::list<MantisVision::Image const*> GetDepthMapImageList();





DecoderInitStatus和DecoderTye是枚举,我还需要换行吗?



VideoStream,PointCloud和Image是我必须包装的其他类,所以在包装类中我必须传递哪个类? VideoStream或WrappedVideoStream?。



DecoderInitStatus and DecoderTye are enums, Do I need to wrap too?

VideoStream, PointCloud and Image are other classes that I have to wrap, so in the wrapped class What class must I pass? VideoStream or WrappedVideoStream?.

推荐答案

您正在创建一组代理类。



http://www.oodesign.com/proxy-pattern.html [ ^ ]



我在猜目的是允许从.NET使用DLL。



您不需要包装枚举,而是为.NET定义等效的枚举。



要回答你的上一个问题,你的包装类会期望包装到其他DLL类。
You're creating a set of proxy classes.

http://www.oodesign.com/proxy-pattern.html[^]

I'm guessing the purpose is to allow the DLL to be used from .NET.

You don't need to wrap the enums but rather define equivalent enums for .NET.

To answer your last question, your wrapped class would expect wrappers to the other DLL classes.


这篇关于用于包装dll的C ++ / CLI项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆