简体   繁体   English

为什么在运行我的 64 位应用程序时,我对 64 位 DLL 的调用不断返回“错误打开 DLL xxxx”?

[英]Why does my call to my 64bit DLL keep returning "Error opening DLL xxxx" when running my 64bit app?

Here's the deal.这是交易。 We have an in-house DLL written in C++ and compiled in MSVS 10. Originally it was created to call COBOL and was only 32bit.我们有一个内部的 DLL,用 C++ 编写,并在 MSVS 10 中编译。最初它是为了调用 COBOL 而创建的,只有 32 位。 We then recompiled the DLL last year to be 64bit and my app (written in PowerBuilder) was able to call it with no issues.然后我们去年将 DLL 重新编译为 64 位,我的应用程序(用 PowerBuilder 编写)能够毫无问题地调用它。

We're now converting the COBOL to Java classes by way of Veryant COBOL which has required some changes to be made to the DLL. Please note, I didn't write this DLL and have very minimal experience with C++. I recently had to take over this part of the project so please be easy with me:)我们现在通过 Veryant COBOL 将 COBOL 转换为 Java 类,这需要对 DLL 进行一些更改。请注意,我没有写这个 DLL 并且对 C++ 的经验非常少。我最近不得不采取在项目的这一部分,所以请对我放轻松:)

After the developer made the required changes to call the Java classes the 32bit can be called by my 32bit app with no issues.在开发人员进行必要的更改以调用 Java 类后,我的 32 位应用程序可以毫无问题地调用 32 位。 However, the 64bit version when called by my 64bit app always ends up resulting in "Error opening DLL".但是,当我的 64 位应用程序调用 64 位版本时,它总是以“打开 DLL 时出错”告终。 I've made sure the DLL and the app are both 64bit.我已经确定 DLL 和应用程序都是 64 位的。 I've looked over all the properties of the project and everything points to 64 environment/variables.我查看了项目的所有属性,所有内容都指向 64 个环境/变量。 Warnings are produced during the build due to variables still using 32bit types but the same occurs for the version that is used for the regular 64bit COBOL and it works.由于变量仍在使用 32 位类型,因此在构建过程中会产生警告,但对于用于常规 64 位 COBOL 的版本也会发生同样的情况并且它可以工作。

Due to different working environments I run a batch file to start my app in order to set the required variables for Veryant or for COBOL, depending on which system I'm running.由于不同的工作环境,我运行一个批处理文件来启动我的应用程序,以便为 Veryant 或 COBOL 设置所需的变量,具体取决于我正在运行的系统。 The only issue I'm having is calling the 64bit DLL that's compiled to call the 64bit Java classes.我遇到的唯一问题是调用编译为调用 64 位 Java 类的 64 位 DLL。 Does anyone have any suggestions on how to track down the issue?有没有人对如何追踪问题有任何建议? I'm at a complete loss at this point.在这一点上我完全不知所措。

I tried taking the 32bit version of the "Veryant" DLL that I am able to call and went through all of the properties of the project and changed everything to be 64bit.我尝试使用我可以调用的“Veryant”DLL 的 32 位版本,检查项目的所有属性并将所有内容更改为 64 位。 I rebuilt the DLL, received warnings of the variables which exist in the working 64bit COBOL version, but got a successful build.我重建了 DLL,收到了工作 64 位 COBOL 版本中存在的变量警告,但构建成功。 I expected to be able to call this DLL from my 64bit app but still receive the "Error opening DLL" message.我希望能够从我的 64 位应用程序调用此 DLL,但仍然收到“错误打开 DLL”消息。

Make sure that the DLL is located in a directory that is listed in the PATH environment variable.确保 DLL 位于 PATH 环境变量中列出的目录中。 This will allow the application to find the DLL when it tries to load it.这将允许应用程序在尝试加载时找到 DLL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM