Running the Debug DLL

Thunderbrd

C2C War Dog
Joined
Jan 2, 2010
Messages
29,936
Location
Las Vegas
This has been mentioned as something many modders on the team still struggle with.

Running the Debug DLL is an important step to take before committing any XML changes. Doing so will help you determine if there are any errors long before they emerge as an obvious problem in the bug thread.

It's very simple. In the Assets folder, you have 2 dlls.

The main is:
CvGameCoreDLL.dll

The debug dll is:
CvGameCoreDLL.dll.debug

The .debug added extension is just there to make the file invalid and invisible to the EXE, which instructs the running of the CvGameCoreDLL.dll, which contains the majority of the game's programming.

When the normal DLL is run, the game processes fairly quickly (in comparison.) When the Debug DLL is run, the game is the same but much slower because many debugging processes are running at the same time. When, for example, I look closely at a bug in the code, I'm running the debug dll attached to Visual Studio to get abilities to stop the processing and read every amount in every variable as it processes. I can control a lot this way. However, for the rest of you, attaching with VS is not necessary.

The Debug DLL also highlights XML errors and even tells you where they are, when you simply load the mod. Priceless.

So to run the Debug DLL in a load process, simply rename the main DLL by adding an extension to make it invisible, like .core. This turning CvGameCoreDLL.dll into CvGameCoreDLL.dll.core.

THEN rename the Debug DLL, removing the .debug extension, leaving it as the file name that the normal DLL is usually. Thus, turn CvGameCoreDLL.dll.debug into CvGameCoreDLL.dll.

Then run the game. You'll notice it takes 5-10 minutes longer to load and if you try to actually play in this mode you'll be getting popup asserts and all sorts of annoyances and it takes about 10 times as long to process everything. Therefore, it is CRITICAL to change the naming on the dlls back to the way they were before committing or you might commit the debug dll as the primary and that will be annoying to anyone who updates that and tries to play.

If anyone has any trouble following these steps successfully, please let me know.

@DH: Would you be so kind as to link this post to the front page of the Modder's Docs?
 
Here is the error message I get when running the debug dll.
 

Attachments

  • debug.JPG
    debug.JPG
    28.3 KB · Views: 174
  • debug1.JPG
    debug1.JPG
    55 KB · Views: 174
  • debug2.JPG
    debug2.JPG
    41.8 KB · Views: 178
You went in to C2C\Assets and changed the DLL in there? And got this? Cause from your screenshots that is not the DLL you should be debugging.
 
Here is the error message I get when running the debug dll.
Your system may not like the debug dll. I noticed that it showed the name all in lower case... that's just the popup displaying it like that right?
 
This is classic XP CTD error reporting. There's little that can be deciphered from these kind of reports sadly.
Edit: Check to see if there is a period at the end of dll.dll ( so it would be dll.dll. ) this could cause a problem where the solution is simple; delete the period. This could have been caused by simple user error where we double click Debug and hit delete or it could be a typographical one.
 
Last edited:
Your system may not like the debug dll. I noticed that it showed the name all in lower case... that's just the popup displaying it like that right?

Yes. The actual file names use upper case as well, as shown below. I tried a few times incase of finger trouble, to no effect.
 

Attachments

  • debug3.JPG
    debug3.JPG
    37.6 KB · Views: 150
Yes. The actual file names use upper case as well, as shown below. I tried a few times incase of finger trouble, to no effect.
Are you trying to RUN the debug dll like an exe by double clicking on it? I realize that I instructed nothing even close to this but in your pic you depict that the debug dll is still named .debug and if you're trying to run the game with the debug dll, the smaller, normally core DLL would be renamed and the debug dll would be named as the core one normally is.
 
My apologies if I was rude with my post, I can't help.

No apology needed - you were not rude. :)

@TB.

I use a desktop shortcut that always loads the current Caveman2Cosmos mod I have downloaded.

Using your guidance in the first post renaming - I get the CTD error. Reverting back to the original .dll - the game loads.

My pic just showed the folder I was using with the correct file names.
 

Attachments

  • upload_2017-3-11_2-3-38.png
    upload_2017-3-11_2-3-38.png
    22.5 KB · Views: 141
No apology needed - you were not rude. :)

@TB.

I use a desktop shortcut that always loads the current Caveman2Cosmos mod I have downloaded.

Using your guidance in the first post renaming - I get the CTD error. Reverting back to the original .dll - the game loads.

My pic just showed the folder I was using with the correct file names.
K, just makin' sure.

Try doing what I said in the first post but then loading C2C the standard way... load BtS and use Advanced->Load a Mod and select Caveman2Cosmos. See if that comes up with a different result.

Quick question: Are you using a steam version download for BtS? Afforess found that doesn't allow dll coding work and it may have been due to a problem with running the debug dll. Might be THIS.

Another thing... and really, the debug dll should always be run like this for any of us, go into the core BeyondTheSword Config file (it's a .ini really) and change the Full Screen = 1 to 0. See if that helps.
 
K, just makin' sure.

Try doing what I said in the first post but then loading C2C the standard way... load BtS and use Advanced->Load a Mod and select Caveman2Cosmos. See if that comes up with a different result.

Quick question: Are you using a steam version download for BtS? Afforess found that doesn't allow dll coding work and it may have been due to a problem with running the debug dll. Might be THIS.

Another thing... and really, the debug dll should always be run like this for any of us, go into the core BeyondTheSword Config file (it's a .ini really) and change the Full Screen = 1 to 0. See if that helps.

No on all counts.
 
hmm... I'm thinking there's just something your system doesn't like. I'm not thinking it's XP biased because I used to run the debugger on XP but it's certainly something odd. All I can say is... if you CAN'T run it, be careful ;)
 
Back
Top Bottom