Questions on the DLL

I think your point is that in the tech tree, you want to put four new icons of the same type, but only the first one appears. I have not looked into the code; but probably the code which puts in the icons is in a loop, which takes the first matching icon and then stops looking. The author of that loop did not expect to have multiple matches. Does that help any?

I'm not sure what you mean by saying the icons are of the same type. They are all different, but in the same atlas. It always displays the last icon, not the first, so I don't know if the code being in a loop could be the problem or not?
 
I fixed my problem--I forgot to change

Code:
if ( gc.getTechInfo(i).getCommerceChange(CommerceTypes.COMMERCE_GOLD) != 0 ):
	[COLOR="Red"]szHealthRateButton[/COLOR] = "[COLOR="red"]HealthRate[/COLOR]" + str(i)
	screen.addDDSGFCAt( [COLOR="red"]szHealthRateButton[/COLOR], szTechRecord, ArtFileMgr.getInterfaceArtInfo("INTERFACE_TECH_ADD_GOLD").getPath(), iX + fX, iY + Y_ROW, TEXTURE_SIZE, TEXTURE_SIZE, WidgetTypes.WIDGET_HELP_GOLD_CHANGE, i, -1, False )
	fX += X_INCREMENT

to something different in three of my four commerce types, so it could only load one at a time.

I made a widget for each of the commerce types and they work fine. The problem is, my game keeps crashing. I set

Code:
; Create a dump file if the application crashes
GenerateCrashDumps = 1

and when the game crashes it gives me a path to Civ4BeyondSword.exe.dmp, but I can't find the file anywhere. Where does this file usually go?
 
I've never seen this file :dunno:.

@crashes: In most cases caused by missing artDefines entries.
Can you compile a debug dll? Would probably help.

I found the file, but have no idea how to read it so it doesn't do me much good.

I'm compiling a debug dll now. Pardon my ignorance, but what am I supposed to do with it?
 
The debug DLL allows you to see the actual source code in action.
It means that in addition to the actual compiled code, the DLL also holds the 'symbols' for each code line and variable, so you can pause the code in the middle and see exactly what each variable holds.
It also means that when the game crashes while you're debugging, Visual Studio will pause the run and show you exactly where in the code the crash happens.

You can look here for some instructions on how to debug.
 
For some reason, when I compile I get the following error:

Spoiler :
fatal error LNK1104: cannot open file 'msvcprtd.lib'


I have a msvcprt.lib in my Microsoft Visual C++ Toolkit 2003/lib folder, but I can't find this file anywhere.
 
Can you post your makefile? Mine has only msvcprt.lib.
You can change msvcprtd.lib to msvcprt.lib, and you might need to add /NODEFAULTLIB:msvcprtd.lib to your Debug_LDFLAGS (but only if it doesn't work without it).
 
You can change msvcprtd.lib to msvcprt.lib, and you might need to add /NODEFAULTLIB:msvcprtd.lib to your Debug_LDFLAGS (but only if it doesn't work without it).

How do I do this?
 
It only brings up the error when I set the build target to debug. Do I need a different .lib file for when I build a debug file?

EDIT: I found the file in Microsoft Platform SDK/Lib/IA64. I tried both adding this path in Settings->Compiler and Debugger->Search Directories->Linker and copying the file into Microsoft Platform SDK/Lib, but these result in the following error:

Spoiler :
fatal error LNK1112: module machine type 'IA64' conflicts with target machine type 'X86'


You can change msvcprtd.lib to msvcprt.lib

I tried making a copy of msvcprt.lib and renaming it msvcprtd.lib. It compiles fine, but brings up the following error when I try to play with it:

Spoiler :
This application has failed to start because MSVCP71D.dll was not found. Re-installing the application may fix this problem.


ANOTHER EDIT: I was browsing the forums, and found this:

http://forums.civfanatics.com/showthread.php?t=326183

According to this, no one has succesfully compiled a debug dll in codeblocks. This was from a while ago, so is this still true? If so, that is probably my problem because I am using codeblocks.
 
Correct, you need to use Microsoft Visual Studio to compile a debug dll. Also MVS removed debugging from their free express version in 2010, so you'll need to find MVS 2008 or 2005. Use 2005 myself.
 
Correct, you need to use Microsoft Visual Studio to compile a debug dll. Also MVS removed debugging from their free express version in 2010, so you'll need to find MVS 2008 or 2005. Use 2005 myself.

Is there a free version? I didn't realize that or I would have used it all along. Where can I get it?
 
From Microsoft. Look for Microsoft Visual Studio Express. It is free. The last time I looked, about a month ago, the 2008 version was still available. They don't put links to it anyplace that is very obvious, like the Visual Studio home page.

Aha! Here it is. I think that the C++ version is vcsetup.exe.
 
I downloaded the 2008 version, and tried to set it up using Refar's guide. I got this far:

Click -OK-. The "Makefile Application Wizard" will open (No picture here).
Click –Next-. Clear all the boxes. Click –Finish-.

When I click OK, it brings up the following window. I'm assuming this is different because I'm using 2008 versus 2005, but what am I supposed to do here?

I'm also using Danny Daemonic's makefile. Does this change anything in Refar's tutorial?
 

Attachments

  • Visual C++ Express 2008 Windows.jpg
    Visual C++ Express 2008 Windows.jpg
    182.2 KB · Views: 84
First, you don't need the 'output for debugging' part. This is not the file that will be run anyway.

Debug Configuration:
Build command line: nmake Debug
Clean command line: nmake Debug_clean
Rebuild command line: nmake Debug_clean <new line> nmake Debug
(not sure how you can add a newline there. Maybe there's a '...' button next to it that opens a multiline edit box?)

And similarly:
Release Configuration:
Build command line: nmake Release
Clean command line: nmake Release_clean
Rebuild command line: nmake Release_clean <new line> nmake Release

After that you don't need to edit the project properties.
 
I set it up succesfully (I think), but I got the following error (so probably not):

Spoiler :
------ Build started: Project: CvGameCoreDLL, Configuration: Release Win32 ------
Performing Makefile project actions
Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
"C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003\bin\cl.exe" /nologo /MD /O2 /Oy /Oi /G7 /DNDEBUG /DFINAL_RELEASE /Fp"Release\CvGameCoreDLL.pch" /GR /Gy /W3 /EHsc /Gd /Gm- /DWIN32 /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /Yu"CvGameCoreDLL.h" /IBoost-1.32.0/include /IPython24/include /I"C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A/Include" /I"C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A/Include/mfc" /YcCvGameCoreDLL.h /Fo"Release\_precompile.obj" /c _precompile.cpp
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003\bin\cl.exe' : return code '0x1'
Stop.
Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
Build log was saved at "file://c:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods\Test SDK\CvGameCoreDLL\Release\BuildLog.htm"
CvGameCoreDLL - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


EDIT: I removed the following parts from the makefile:

Code:
TOOLKIT=C:\Program Files[COLOR="Red"] (x86)[/COLOR]\Microsoft Visual C++ Toolkit 2003
PSDK=C:\Program Files[COLOR="red"] (x86)[/COLOR]\Microsoft SDKs\Windows\v6.0A

and now it compiles fine. Is ' (x86)' supposed to be there?
 
Those are the paths directing MVS where to look for the 2003 toolkit (Civ4 was compiled for 2003) and where to look for the libraries it needs. So they need to point to the correct location on your computer; Danny Daemonic must be using windows vista, and so that x86 was in the file path, you must not be.
 
Could someone please explain the debugging process to me? I read Refar's guide, but I don't really understand what it is saying. :confused:
 
Top Bottom