How to compile the DLL

DaveMcW

Deity
Joined
Oct 8, 2002
Messages
6,489
Here is how I was able to compile the DLL. Thanks to whoward69 and Gedemon for several hints.

1.
Download and run http://download.microsoft.com/.../vcsetup.exe.

2.
Start Steam and select Library -> Library -> Tools.
Find "Sid Meier's Civilization V SDK", right-click it, and select Install Game.

3.
Copy "C:\Program Files (x86)\Steam\SteamApps\common\sid meier's civilization v sdk\CvGameCoreSource" to "My Documents\Visual Studio 2008\Projects\CvGameCoreSource".

4.
Open "CvGameCoreSource\CvGameCoreDLL \CvGameCoreDLL.rc" in notepad.
On line 10, replace "afxres.h" with "windows.h"

5.
Open "CvGameCoreSource\CvGameCoreDLL_Expansion1 \CvGameCoreDLL.rc" in notepad.
On line 10, replace "afxres.h" with "windows.h"

6.
Open "CvGameCoreSource\CvGameCoreDLL_Expansion2 \CvGameCoreDLL.rc" in notepad.
On line 10, replace "afxres.h" with "windows.h"

7.
Start Visual C++ 2008 Express Edition.
File -> Open -> Project/Solution.
Open CvGameCoreSource\CvGameCoreDLL.vs2008.sln

8.
Right-click CvGameCoreDLL and select Properties -> Configuration Properties -> Linker.
Change the Output File to: $(OutDir)\CvGameCoreDLLFinal Release.dll

9.
Right-click CvGameCoreDLL_Expansion1 and select Properties -> Configuration Properties -> Linker.
Change the Output File to: $(OutDir)\CvGameCore_Expansion1.dll

10.
Right-click CvGameCoreDLL_Expansion2 and select Properties -> Configuration Properties -> Linker.
Change the Output File to: $(OutDir)\CvGameCore_Expansion2.dll

11.
Save all.

12.
Build -> Build Solution. You could also right-click a single DLL and just build that one.

13.
Find the new DLL in "CvGameCoreSource\BuildOutput". Add it to the root directory of your mod, and set the "Import into VFS" property to true.
 
Rename the compiled DLL to CvGameCoreDLLFinal Release.dll or CvGameCore_Expansion1.dll (or rename directly the project, or change the target name...) and simply add them to your mod project with the VFS property set to true.
 
4. Open "CvGameCoreSource\CvGameCoreDLL \CvGameCoreDLL.rc" in notepad.
Replace both occurances of "afxres.h" with "windows.h".

5. Open "CvGameCoreSource\CvGameCoreDLL_Expansion \CvGameCoreDLL.rc" in notepad.
Replace both occurances of "afxres.h" with "windows.h".

Only the first occurance in each file needs to be replaced, the second is part of how visual studio auto-generates files.

And then only if you are using the free Express version, if you already own the full version there is no need to make these edits.
 
13. Find the new dlls in "CvGameCoreSource\BuildOutput". When you add them to your mod, be sure to set the "Import into VFS" property to true.

They must be added at the "root", do NOT create a sub-folder (eg DLL) and place them in there - it will not work (found that out the hard way :blush:)
 
this game is driving me crazy, it does not load the DLL anymore using the VFS property...
 
correction: it works with the G&K DLL, it doesn't with the Vanilla DLL.
 
Glad to know that they used VS 2008

There is also a project for VS 2010 (but if you use that you still need to install VS 2008), so you can use either
 
correction: it works with the G&K DLL, it doesn't with the Vanilla DLL.

Have you found the following in CvDllContext.cpp and made the required change?

Code:
// WARNING! This must be unique for each DLL!
// If you are a modder and you are creating your own DLL from the original source, this must be changed to a unique GUID.
// Use the Visual Studio Create GUID option in the Tools menu to create a new GUID.
// {C3B2B6B3-439C-480b-8536-1CF39FCFC682}
static const GUID CIV5_CORE_RELEASE_DLL_GUID =
{ 0xc3b2b6b3, 0x439c, 0x480b, { 0x85, 0x36, 0x1c, 0xf3, 0x9f, 0xcf, 0xc6, 0x82 } };
 
Thanks, done now, but still not loading via the mod :/

(here's a link to a GUID Generator btw if someone need it)

It works for you for both version ?

Maybe it's because of the initialization method of the mod I'm using, it auto-deactivate GK in ModsMenu.Lua, and call again Modding.ActivateEnabledMods()... I'll try later with a simpler mod.
 
It works for you for both version ?

Only using G&K at the moment ... I wonder if vanilla needs the OnGetDLLPath stuff (as the G&K expansion effectively provides it's own version of that anyway)
 
Sorry for asking an amateur question, but can any (new) DLL gurus probably provide some clear steps on how to deploy these modded DLL files. I noticed they are starting to appear on the forums but I gather many like me don't have a clue how to deploy them via Modbuddy.

I have read some threads stating to replace files which sets alarm bells into motion and brings back memories of the Civ4 override days!

Apologies if this is pointed out and I missed it :blush:
 
Sorry for asking an amateur question, but can any (new) DLL gurus probably provide some clear steps on how to deploy these modded DLL files. I noticed they are starting to appear on the forums but I gather many like me don't have a clue how to deploy them via Modbuddy.

I have read some threads stating to replace files which sets alarm bells into motion and brings back memories of the Civ4 override days!

Apologies if this is pointed out and I missed it :blush:

See post #2 and #4

Basically you add the DLL as a file (in the root) to your ModBuddy project and set VFS=true, and then build your mod as usual

BUT (and it's a very big but) you can only play with one mod that has it's own (new) DLL at a time - so if both IGE and CSD (say) start shipping with their own DLL you're going to have to make a choice, one or the other but not both at the same time. DLL modding is going to favour the "total conversions" ... it does rather destroy my "many small mods on the buffet table" approach :sad:
 
See post #2 and #4

Basically you add the DLL as a file (in the root) to your ModBuddy project and set VFS=true, and then build your mod as usual

BUT (and it's a very big but) you can only play with one mod that has it's own (new) DLL at a time - so if both IGE and CSD (say) start shipping with their own DLL you're going to have to make a choice, one or the other but not both at the same time. DLL modding is going to favour the "total conversions" ... it does rather destroy my "many small mods on the buffet table" approach :sad:

Bingo...thats the info I was after...thanks for clarifying.

How hard would it be for our DLL modders to come to some agreement on releasing a single 'community' DLL that includes bug fixes and performance improvements so that us non-DLL types can not have to worry about multiple DLLs that fix issues. Of course, game changing features should continue to be released separately as per normal mod approach.
 
How hard would it be for our DLL modders to come to some agreement on releasing a single 'community' DLL that includes bug fixes and performance improvements so that us non-DLL types can not have to worry about multiple DLLs that fix issues.

IMHO impossible ... as it's impossible to define "bug fix".

Look at CivUP, a lot of stuff in there was/is "bug fixes" ... but only if you believe the "feature" to be broken in the first place, which in a strategy game with players of very different skill levels will always be subjective. One player's "bug fix" will usually be another player's "bug"
 
I knew you were going to say that!

If I was to define bugs it would be:
- Incorrect info ingame
- Bugs reported to Firaxis but not resolved yet
- UI issues
- Possible CTD game issues

Not game 'enhancements', stat changes or redefining how a game element should work. If it changes the game mechanics or feel then it is a new feature and not a big fix.

As for performance improvements, it would be typical things like speeding up next turns.
 
- Bugs reported to Firaxis but not resolved yet

So is the inability of a ship to enter a coastal fort a bug or an enhancement ... depends who you ask ;)
 
Top Bottom