[已解决] Regsvr32错误:“找不到指定的过程" [英] [Solved] Regsvr32 error: 'The specified procedure could not be found'

查看:121
本文介绍了[已解决] Regsvr32错误:“找不到指定的过程"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的工作是为更大的项目创建一个DLL.它一直运行良好,但是最近几天我似乎对其做了一些事情,阻止了它使用Regsvr32正确注册.

当然,我可以回滚我的代码等,但是我正在寻找一种更有效和更具建设性的方法(而不是破坏性的代码编写方法)来解决该问题.

一旦Regsvr32开始运行,标题中就会发生错误.

我使用Visual Studio2005.

我尝试通过将Regsvr32作为命令行属性放在项目属性的调试部分中,并将我的DLL名称设置为输入(当然,DLL目录作为工作目录)来调试DLL.

但是,在我可以找到一个断点之前,事情就破裂了. App构造函数中的断点为赶上罪魁祸首为时已晚.

错误发生的速度如此之快,我怀疑这与内存分配有关,因此声明静态变量之类的事情似乎是一个不错的目标.但是,我已经将代码与当前的一组静态变量一起使用.我唯一要做的就是删除一些.

DLL很高兴地通过了编译器.

这是以前发生的,问题是我声明了一个静态变量CStdiofile m_myFile = NULL.

但这一次似乎并非如此.

我不知道该怎么办.任何帮助,不胜感激!

==============================================

花了3个工程师和一个完整的工作日,但最终我们弄清楚了.

它与建议的分辨率基本相同:我在32位计算机上使用了64位特定功能!

无论如何,谢谢您的建议!

Hi
My job is to create a DLL for a bigger project. It''s been working fine, but it seems I''ve done something to it in the last couple of days that prevents it from being registered correctly using Regsvr32.

Sure, I can roll back my code etc but I''m looking for a slightly more efficient and constructive (rather than destructive in terms of code writing) method for solving the problem.

The error in the title occurs as soon as Regsvr32 starts running.

I use Visual Studio 2005.

I''ve tried debugging my DLL by putting Regsvr32 as the command line command in the debug section of the project property and setting my DLL name as the input (and the DLL directory as the working directory of course).

However, the thing breaks before I can catch it with a break point. Break point in the App constructor is too late at catching whatever the culprit is.

The error is happening so quickly I suspect it''s something to do with memory allocation, so things like declaring static variables seemed like a good target. However I have had the code working with the current set of static variables. The only thing I have done is to remove a few.

The DLL passes through the compiler quite happily.

It''s happened before and the problem was that I had declared a static variable CStdiofile m_myFile = NULL.

But this time, that doesn''t seem to be the case.

I''m lost as to what to do. Any help greatly appreciated!

================================================

It took 3 engineers and a whole working day, but we figured it out in the end.

It''s basically the same as the suggested resolution: I was using a 64-bit specific function on a 32-bit machine!

Thanks for the suggestion, anyway!

推荐答案

首先,您应该检查DLL是否仍然导出所有必需的方法.

然后确保它不依赖于其他未在regsvr运行时加载的库.具有静态(全局?)变量是危险的,您可能尝试用指针(CStdiofile* m_myFile = NULL;)替换CStdiofile,以便在加载DLL时不构造该实例.稍后在堆(m_myFile = new CStdiofile();)上构造它.

通常,您应该尝试以一种在加载DLL时不执行任何代码的方式创建DLL,因此请不要使用全局对象,也要注意在DllMain中执行的操作.阅读有关DllMain以及regsvr调用的MSDN.

您也可以查看以下内容: ^ ],其中显示了可能出问题的示例.

编辑:刚刚发现了其他内容:
First you should check if your DLL (still) exports all required methods.

Then make sure it does not depend on other libraries which are not loaded at the time regsvr runs. Having static (global?) vars is dangerous, you might try to replace your CStdiofile by a pointer (CStdiofile* m_myFile = NULL;) so the instance does not get constructed while loading the DLL. Construct it later on the heap (m_myFile = new CStdiofile();).

Generally you should try to create your DLL in a way that NO code is executed while loading the DLL, so don''t use global objects and also be careful what you do in your DllMain. Read MSDN regarding DllMain and regarding the calls regsvr does.

Also you might check out this: http://blogs.msdn.com/b/jigarme/archive/2007/03/17/regsvr32-exe-gives-error-quot-the-specified-procedure-could-not-be-found-quot.aspx[^] which shows a sample of what might go wrong.

Edit: Just found something else: http://www.tech-archive.net/Archive/VC/microsoft.public.vc.atl/2007-12/msg00118.html[^]

Ah, 32bit and 64bit - have to remember this :)


这篇关于[已解决] Regsvr32错误:“找不到指定的过程"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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