用C#导入的Cli编写的dll [英] Cli written dll imported in C#

查看:130
本文介绍了用C#导入的Cli编写的dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我有一个包装器的构造函数,用于封装如下这样的c ++代码:

I have for example a constructor to a wrapper made to englobe c++ code like this:

FOONET::ManagedFoo::ManagedFoo(const std::wstring & q)

这是在我的clr项目中. ..我将其编译为dll以在c#中使用.
将dll用作参考之后,当我在参考中查找相同的构造函数时,我会得到:

this is in my clr project...I compile it as dll to use in c#.
After I put the dll as reference and when I look inside the reference for the same constructor I get :

ManagedFoo(std.basic_string_unsigned short,std::char_traits_unsigned short_,std::allocator_unsigned short_ _* q)


为什么是这样 ?更重要的是,如何将字符串传递给该构造函数以创建ManagedFoo实例?


why is this ? And more importantly how can I pass a string to that constructor in order to create a ManagedFoo instance ?

推荐答案

我设法更改了cli项目中的代码,以请求字符串,并将该方法内部的字符串更改为wchat_t,并将其传递给C ++.
I managed to change the code in the cli project to request a string and changed the string, inside the method, to wchat_t which I passed over to the C++.


这篇关于用C#导入的Cli编写的dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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