不能从C#调用C ++函数 [英] can't call C++ function from C#

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

问题描述

我有一个具有一组功能的DLL。该DLL与themidia一起使用,使其安全。



当我尝试调用这些函数时,由于函数名称,C#会发出错误。

  [DllImport(security.dll,CallingConvention = CallingConvention.StdCall,ExactSpelling = true)] 
private static extern IntPtr _encryptLogin @ 8(string string_0,string string_1);

如果我删除@ 8并删除ExactSpelling = true,它只返回一个异常,表示没有入口点



我正在做错什么?

解决方案

删除@,并在您的属性中添加 EntryPoint =_ encryptLogin @ 8


I have a DLL with a set of functions. The DLL was used with "themidia" to make it safe.

When I try to call the functions, C# spits out errors due to the functions names.

[DllImport("safety.dll", CallingConvention=CallingConvention.StdCall, ExactSpelling=true)]
private static extern IntPtr _encryptLogin@8(string string_0, string string_1);

If I remove the @8 and remove ExactSpelling=true, it just returns an exception saying no entry point.

What exactly am I doing wrong?

解决方案

Remove the "@", and in your attribute add EntryPoint="_encryptLogin@8"

这篇关于不能从C#调用C ++函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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