Click here to Skip to main content
13,733,512 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
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!
Posted 1-Dec-10 19:09pm
Updated 1-Dec-10 22:06pm
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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 :)
  Permalink  
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180920.1 | Last Updated 2 Dec 2010
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100