Dll在C#中不起作用,但在C ++中起作用!

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.