如何在С#上的DLL和ATL项目之间进行传输 [英] How can I transfer between DLL on С# and ATL project

查看:52
本文介绍了如何在С#上的DLL和ATL项目之间进行传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用C#编写的DLL,这是我的常规应用程序-具有MFC支持的ATL项目. DLL使用string类型的数据,接受它们并将其传回.我应该使用哪种数据类型将string传输到DLL并从那里接收它们?我应该在DLL中使用"string"还是"ref string"来接收数据?我对LPCTSTRTCHARBSTRCHAR ...有点困惑. ......... DLL这样连接将托管代码导出为Unmanaged .

Hi, I have a DLL, written in C#, my general application - ATL project with MFC support. The DLL works with string type data, accepts them and transfers back. What data type should I use to transfer string into DLL and to receive them from there? Should I use "string" or "ref string" in DLL to receive data? I''m a little confused with LPCTSTR, TCHAR, BSTR, CHAR....
.........DLL connected like this Exporting Managed code as Unmanaged.

推荐答案

本文对此有很好的解释:

http://blogs.msdn.com/b/ericlippert/archive/2003/09/12/52976.aspx [ ^ ]

如果此问题对您有帮助,则将其标记为已回答.这样,其他人可能会参考这些答案.
This article has a great explanation for this:

http://blogs.msdn.com/b/ericlippert/archive/2003/09/12/52976.aspx[^]

Mark this question as answered if it helps you. This way other people may refer to this for their answers.


BSTR是最好的字符串类型.
BSTR is the best string type to use.


好,我使用了char*在非Unicode项目中.可以.
OK, I used char* in non Unicode project. It works OK.


这篇关于如何在С#上的DLL和ATL项目之间进行传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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