views:

120

answers:

2

Is there a maximum number of times that a DLL can be registered and unregistered in a specific time period?

Here's what I mean and why: I have a Continuous Integration package that builds my VB6 applications and in order to build each of the 80 components of the solution, I:

  1. retrieve each project's dependencies in turn
  2. register the dll (in NAnt using < comregister unRegister="false" ... ... >)
  3. build the project
  4. publish the output .dll or .exe somewhere safe
  5. un-register the dll (in NAnt using < comregister unRegister="true" ... ... >)

Now, this all works 100% of the time, IF I build each of the 80 projects manually; however, if I get my NAnt script to build all 80 projects in turn (in the correct order) then the build fails, giving me this error in CruiseControls' output...

[comregister] Unregistering 1 files
[comregister] c:\location\myBuild.include(301,4): Error while unregistering 'c:\\[project-location]\lib\myDependentDLLFile.dll' Unable to find an entry point named '**DllUnregisterServer**' in DLL 'c:\\[project-location]\lib\myDependentDLLFile.dll'.

(I don't know where 'DllUnregisterServer' comes from though!)

The same error then appears for every subsequent project that I build past the point of failure, which is around the 50-projects-built area. What I mean, is that the first 50 projects build fine, then the rest fail in-turn.

I have mitigated this by using the failonerror="false" attribute within the comregister call inside NAnt, but this then throws doubt in my mind as to whether this is ok or not...!

Ideally, I'd like to remove the failonerror attribute and report genuine errors back to CruiseControl's logging facilities. Any thoughts or suggestions?

+1  A: 

No there's no maximum. Use Dumpbin.exe or Depends.exe to take a look inside that DLL and check that DllUnRegisterServer entry point is actually defined.

Paul Mitchell
The DLLs that are being unregistered and are failing are ones that I will have built earlier in the process - do you think there could be an issue further up the chain??
Brett Rigby
DllUnregisterServer is the entry point used to unregister a COM server. If this is a COM server DLL then you need to make sure it has that entry point. If it's not then don't try to register it or unregister it. In fact, I don't see why you'd be unregistering it during a build anyway.
Paul Mitchell
Well, I was trying to unregister it as otherwise I'd have the same dll registered a million times in different locations on my PC/server. Reason being, I am using Ivy to resolve the dependencies from its' repository to a lib folder within the folder that project (that is being built at that instance) lives. Because its a VB6 dll, I have to register it before use, and then I was hoping to clean-up after myself and unregister the un-needed dependency files. Thats all, really.
Brett Rigby
A COM server can only be registered once. If you register it again from a different location then that registration information will replace the former. So you probably don't need to unregister it at all. But that doesn't explain the error you're getting. Your DLL should contain that entry point if it's a COM server DLL.
Paul Mitchell
A: 

I dont think teher is any limit to the no of DLL register/unregister.

Bhaskar
Well, thats what I thought originally, but this seems to show me otherwise... :o(
Brett Rigby