程序入口点<功能>不能位于动态链接库< dll>中。 [英] The procedure entry point <function> could not be located in the dynamic link library <dll>

查看:62
本文介绍了程序入口点<功能>不能位于动态链接库< dll>中。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经转换了所有VB.NET DLL声明

I have converted all of the VB.NET DLL declarations

Declare Function SFileOpenArchive Lib "Storm.dll" Alias "#266" (ByVal lpFileName As String, ByVal dwPriority As Integer, ByVal dwFlags As Integer, ByRef hMPQ As Integer) As Boolean

进入Delphi。

function SFileOpenArchive(lpFileName: String; dwPriority, dwFlags, hMPQ: Integer): Boolean; stdcall; external 'Storm.dll';

但是,当我调用函数并编译程序时,出现以下错误:

However, when I call the functions and compile the program I get the following error:


过程入口点SFileOpenArchive不能位于动态链接库Storm.dll中。

The procedure entry point SFileOpenArchive could not be located in the dynamic link library Storm.dll.

我确保:


  1. DLL与应用程序存储在同一目录中

  2. 我声明的功能存在(我得到了用VB.NET编码的源代码)

该如何解决此错误?

谢谢您。

推荐答案

您有以下问题,我可以看到:

You have the following problems that I can see:


  1. 该函数已按序数而不是名称导出。您需要在Delphi代码中指定序数。

  2. 第一个参数应该是PAnsiChar而不是Delphi字符串。 VB代码使用字符串来指示编组器传递以空值结尾的字符串。根据经验,在DLL导入或导出中包含Delphi托管类型(如字符串)几乎总是一个错误。

  3. 最后一个参数是通过引用传递的。那是一个Delphi的var参数。

  4. 我认为返回值应该是BOOL,但这可能不会给您带来麻烦。

  1. The function has been exported by ordinal rather than name. You need to specify the ordinal in your Delphi code.
  2. The first parameter should be PAnsiChar rather than a Delphi string. The VB code uses string to instruct the marshaller to pass a null-terminated string. As a rule of thumb, it's almost always a mistake to include a Delphi managed stype like string in a DLL import or export.
  3. The final parameter is passed by reference. That's a Delphi var parameter.
  4. The return value should be BOOL, I think, but that probably won't be causing you trouble.

将它们像这样放在一起:

Put it all together like this:

function SFileOpenArchive(lpFileName: PAnsiChar; 
    dwPriority, dwFlags: Integer; var hMPQ: Integer): BOOL; 
    stdcall; external 'Storm.dll' index 266;

请注意,我不是100%确定文本编码为ANSI。但是,您的主要障碍是顺序导入。希望我已经为您解决了。我相信您可以解决其余的详细信息。

Note that I'm not 100% sure that the text encoding is ANSI. However, the main blockage for you was the ordinal import. I hope I've cleared that for you. I trust you can resolve the remaining details.

这篇关于程序入口点<功能>不能位于动态链接库< dll>中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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