System.EntryPointNotFoundException:无法找到入口点

琼格·邦普特

我在执行它时将VB6转换为c#会产生此错误

从VB6

Declare Function OpenCommPort Lib "C:\Program Files\MR705API.dll" Alias "?OpenCommPort@@YGHPADPAPAX@Z" (ByVal PortName As String, ByRef hCom As Long) As Long
Declare Function CloseCommPort Lib "C:\Program Files\MR705API.dll" Alias "?CloseCommPort@@YGHPAX@Z" (ByVal hCom As Long) As Long
Declare Function SetLED Lib "C:\Program Files\MR705API.dll" Alias "?SetLED@@YGHPAXEE@Z" (ByVal hCom As Long, ByVal Led As Byte, ByVal Addr As Byte) As Long
Declare Function ActiveBuzzer Lib "C:\Program Files\MR705API.dll" Alias "?ActiveBuzzer@@YGHPAXEE@Z" (ByVal hCom As Long, ByVal DelayTime As Byte, ByVal Addr As Byte) As Long
Declare Function Iso14443Reqa Lib "C:\Program Files\MR705API.dll" Alias "?Iso14443Reqa@@YGHPAXEPAEE@Z" (ByVal hCom As Long, ByVal ReqAMode As Byte, ByVal ATQ As String, ByVal Addr As Byte) As Long
Declare Function Iso14443Anticoll Lib "C:\Program Files\MR705API.dll" Alias "?Iso14443Anticoll@@YGHPAXEPAE1E@Z" (ByVal hCom As Long, ByVal AnticollMode As Byte, ByVal Uid As String, ByVal MultiTag As String, ByVal Addr As Byte) As Long

在C#中

        [DllImport ("MR705API.dll")]
        public static extern long OpenCommPort(String portName, ref long hCom ); 

        [DllImport ("MR705API.dll")]
        public static extern long CloseCommPort(long hCom);

        [DllImport ("MR705API.dll")]
        public static extern long SetLED(long hCom, byte Led , byte Addr);

        [DllImport ("MR705API.dll")]
        public static extern long ActiveBuzzer (long hcom, byte DelayTime, byte Addr);

        [DllImport ("MR705API.dll")]
        public static extern long Iso14443Reqa (long hcom, byte ReqAMode, string ATQ, byte Addr);

以及我如何使用它。

public void doReader() {

            Result = OpenCommPort("COM9", ref HANDLE);
            ....
            ....
}

例外

System.EntryPointNotFoundException: Unable to find an entry point named 'OpenCommPort' in DLL 'MR705API.dll'.

   at TrueReader.MainForm.OpenCommPort(String portName, Int64& hCom)
   at TrueReader.MainForm.doReader() in c:\Users\sattha\Documents\SharpDevelop Projects\TrueReader\TrueReader\MainForm.cs:line 59
   at TrueReader.MainForm.Timer1Tick(Object sender, EventArgs e) in c:\Users\sattha\Documents\SharpDevelop Projects\TrueReader\TrueReader\MainForm.cs:line 54
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at TrueReader.Program.Main(String[] args) in c:\Users\sattha\Documents\SharpDevelop Projects\TrueReader\TrueReader\Program.cs:line 27

谁能指导我,我做错了什么?还是我想念什么。

我不知道此.dll是怎么写的以及用哪种语言编写。

但它曾经在VB6中使用过。

琼格·邦普特

您应该为每个DLL导入功能定义入口点

只需将入口点从Alias您的VB6代码复制到C#

例如... VB6中的“ OpenCommPort”

别名“?OpenCommPort @@ YGHPADPAPAX @ Z”

TO-> C#中的“ OpenCommPort”

[DllImport ("MR705API.dll",
EntryPoint="?OpenCommPort@@YGHPADPAPAX@Z")]
public static extern int OpenCommPort(string portName, ref int hCom); 

附加的

longVB6中等效intC#

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

无法使用Magick.NET:System.EntryPointNotFoundException

无法解决的外部/过程入口点无法在BPL中找到

EFCore MAC - 无法找到名为“AppleCryptoNative_SslCreateContext”的入口点

Excel VBA,无法从DLL文件中找到DLL入口点

无法在 exe 中找到过程入口点

Docker入口点“未找到”

无法找到System.Data.SqlClient参考

无法确定功能入口点

Docker无法运行入口点

System.EntryPointNotFoundException +无法安装包'SQLite.Interop.dll 1.0.103'。我的项目目标是'.NETFramework,Version = v4.6.1'

无法在 DLL“Dll.dll”中找到名为“JoinString”的入口点。在 C# 中

为什么在使用自定义入口点时webpack无法找到反应?

无法在动态链接库中找到过程入口点clCreateCommandQueueWithProperties

从自定义 PE 文件中的 dll 导入时,无法找到过程入口点 MessageBoxA

无法在dll中找到过程入口点GOMP_parallel

为什么收到“无法在DLL中找到名为'SquareRoot'的入口点”消息?

Qt5部署“无法找到过程入口点”

Add-AzureRmAccount:无法在 DLL“iphlpapi.dll”中找到名为“GetPerAdapterInfo”的入口点

GWT编译错误:不在src / main / java中时无法找到入口点

未找到 RGBFilters 入口点 DllRegisterServer

travis构建失败,无法找到-lboost_system

Powershell无法找到类型[System.Windows.Forms.KeyEventHandler]

当我添加异步时无法找到System.Runtime

System Center Configuration Manager 无法在域中找到用户或设备

System.FormatException无法找到可识别的数字

dnx红est“ System.EntryPointNotFoundException:uv_loop_size”

入口点无法执行命令

Docker 无法在入口点授予脚本权限

无法扩展父级的入口点