Dll在C#中不起作用,但在C ++中起作用! [英] Dll doesn't work in C# but works in C++ !!

查看:91
本文介绍了Dll在C#中不起作用,但在C ++中起作用!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个DLL,它可以完成一些用C(或C ++)编写的低级工作.我试图在C#中导入它(使用DLLImport)并使用它,但是它不起作用,但它在C ++中起作用.为什么dll可以在C ++中工作但不能在C#中工作?我该如何解决?
在此先感谢.

I have a DLL that is to do some low level job that is written in C (or C++). I tried to import it (with DLLImport) in C# and use it, but it doesn''t work, but it works in C++. Why a dll can work in C++ but not in C#? How can I fix it?
Thanks in advance.

推荐答案

它无法...查找功能":
您是否检查过DllImport语句中是否没有错字?您是否检查了功能的签名以及参数的编组?
如果您不执行这些任务,那么您至少应该向我们展示C语言中定义的函数以及您的DllImport语句.
"it can not ... find function":
Did you check that you have no typos in your DllImport statement? Did you check the signature of the function, and the marshalling of the parameters?
If you do not cope with these tasks, you sould at least show us the function as it is defined in C, and your DllImport statement.


这篇关于Dll在C#中不起作用,但在C ++中起作用!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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