本文介绍了为什么需要将非MFC DLL编译为“在静态库中使用MFC"才能在VB中引用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我什至无法量化这个论坛为我提供的次数解决方案,但我最终遇到了似乎尚未得到解决的问题.  我有一个完全在VS 2008中开发的多项目解决方案,该解决方案引用了VB中的C ++ DLL. C ++ DLL是作为Win32项目创建的,其唯一的非默认设置是"Application type = DLL".和导出符号"已选中.  我添加了一个模块文件,并将函数导出到DLL项目中,以便在VB中进行引用.  在VB表单中,我已经使用标准格式(例如,公共声明函数FunctionName Lib< DLLName.dll”()作为ReturnType)从DLL声明了我要使用的函数. =">  一切在开发计算机上都可以正常运行,但是任何其他计算机都无法加载DLL,除非该DLL编译时带有在静态库中使用MFC"选项.与使用标准Windows库"默认值.  该DLL不使用MFC,因此我不明白为什么这样做是必要的;实际上,我实际上是偶然发现的,因为它肯定不是我认为引起问题的第一件事.  所有机器都是最新的.Net 3.5,这是我最初认为的原因.  我还提供了指向我创建的简化解决方案的链接,该解决方案可以复制该问题,即.它将在开发机器上正常运行,但是将编译后的DLL和EXE带到另一台机器上会产生错误,除非该DLL的编译选项为在静态库中使用MFC".

此处是链接:
https://oncourse.iu. edu/access/content/user/angleton/Filemanager_Public_Files/DLL%20Problem/DLL%20Problem.zip

Hello, I can’t even quantify the number of times this forum has provided me with solutions, but I’ve finally ran into something that doesn’t appear to have already been answered.  I’ve got a multiple-project solution, developed entirely in VS 2008, that references a C++ DLL in VB.  The C++ DLL was created as a Win32 Project whose only non-default settings were “Application type=DLL” and “Export symbols” selected.  I added a module file with the function exports to the DLL project in order to reference it in VB.  In the VB form, I’ve declared the function I want to make use of from the DLL using the standard format (e.g. Public Declare Function FunctionName Lib “DLLName.dll” () As ReturnType).  Everything works fine on the development machine, but any other machine is unable to load the DLL, UNLESS the DLL is compiled with the option to “Use MFC in a Static Library” as opposed to the “Use Standard Windows Libraries” default.  The DLL does not use MFC, so I don’t understand why this would be necessary; indeed I actually discovered it on accident because it certainly wasn’t the first thing I thought was causing the problem.  All machines are up-to-date with .Net 3.5, which is what I originally thought was causing it.  I’ve also provided a link to a simplified solution I’ve created that replicates the problem, viz. it will run fine on the development machine but taking the compiled DLL and EXE to another machine generates an error unless the DLL is compiled with the option to “Use MFC in a Static Library.”

Here is the link:
https://oncourse.iu.edu/access/content/user/angleton/Filemanager_Public_Files/DLL%20Problem/DLL%20Problem.zip

推荐答案



这篇关于为什么需要将非MFC DLL编译为“在静态库中使用MFC"才能在VB中引用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 03:24