Compilation flags (Or: Do we really need a makefile?)

Asaf

Sleep Deprived
Joined
Mar 22, 2010
Messages
1,326
(Warning: some technical stuff ahead)

I think we can compile the DLL with newer VC++ tool kits than 2003, which means that there's no more need to look for old files and platforms, and there's no need for a makefile (since we can use the Visual Studio regular Win32 DLL project).

I will test all of what I write here later on when I have the chance, but I'm not sure if my test will be enough, so I'd like to hear other people's opinions on this.

I'll explain:
The current compilation flags include /MD, which means that the runtime library used is the multi-threaded DLL. This means that the runtime library code is not embedded in the CvGameCoreDLL but is loaded as a separate DLL when the process runs.

I assume that the game's exe file uses the same compilation flag, so the the same runtime library DLL (VC++ 2003) is loaded for the exe. This means that we cannot change the VC++ version of the CvGameCoreDLL since two conflicting runtime library DLL's will be loaded for the game.

I suggest changing this flag to /MT - which will embed the runtime library code into the CvGameCoreDLL itself. This will mean that no such conflict can be created even if we use a newer VC++ runtime library (2005, 2008).

It will cause the CvGameCoreDll to be slightly bigger, the game will take a little more memory when running, and people who use the new compiled DLL will need to make sure they have the VC++ appropriate redistributable installed (EDIT: I guess this is not the case, since the runtime will be embedded in the DLL).

But it will be much easier to start compiling the DLL.

The main problem I see here are the boost and python libraries which are linked into the DLL. They will need to be replaced to the correct VC++ version as well, and I'm not sure if this will cause any conflicts.

Has this been attempted before? Do you think it'll work properly? is this way preferred?
 
Please figure this stuff out and give the common man a chance to get into SDK modding. Because learning C++ seems like a piece of cake compared to the utter ridiculousness involved with figuring out the compilation of the blasted DLL.
 
the chance is already there. did you try to follow the tutorial made by Refar Baldyr? There is also a setup for Codeblocks, I think it works without a makefile, but I could be easily wrong, it's been quite some time.
 
I so don't have the time or patience to even read any this stuff. It all just seems outdated, at best. And by the way, someone else just talked down Codeblocks in another thread - whatever that may be. (I doubt I even wanna know. :p) I wanna mod, not learn a bunch of computer geek crap that is only going to give me gray hairs before I ever manage to get it working.

What I need is a simple, clear and doable way to do this one single little task. Until I'm able to simply follow a set of fool-proof steps to compile the DLL I'm not even gonna consider reading one single word about the C++ language as such. When I do get into it I wanna go all the way, really learn the language and SDK modding. Preferable all of it, or at least everything worth knowing in regard to modding. But I have no desire to do it as long as I need to learn anything about the actual compilation. Because I'm not currently looking to use C++ for anything else than CivIV modding. I don't even need to know how it works - just that it works.

So one updated tutorial that boils the whole thing into as few steps as possible (obtaining and installing software and add-ons and junk included :rolleyes:) should do. I don't even wanna look at any more outdated guides aimed at versions long gone, utilizing software no longer available.

How many threads are there to date about failing to follow said guides? The more I read about the troubles of others, the less I wanna try my hand at something as pointless.
 
Back to topic, guys.

Has this been attempted before? Do you think it'll work properly? is this way preferred?

No, no idea, probably.

For a bit more text: I don't think anyone else here is really enough familiar with the compilation flags and the VS setup to have ever thought about that stuff.
The suggestion itself sounds good, because then we have to think less about the program setup, right?
 
I'm thinking that new ideas on how to do things is a good thing. At this point. So I'd say go ahead and investigate, whatever it is the topic of this thread concerns. (I guess its technical.)
 
And the obvious questions that pop-up are what a Platform SDK is? (But we can just let Asaf explain everything in his updated guide. :D)
 
An on-topic update:
I managed (after fiddling with some compiler flag) to compile and link the DLL, but it crashed when the game started loading.
Some debugging revealed the issue: The DLL sends STL objects (specifically std::string and std::vector) to the exe, so using another version causes conflicts at runtime.

I'll try finding a workaround, but I'm not optimistic at all.
Guess we stay with the good ol' Visual C++ Toolkit 2003...

(But we can just let Asaf explain everything in his updated guide. :D)

No pressure then, yes?
 
Well, back on topic (if anyone's interested) :rolleyes:

There is no good solution for the STL problem. I guess I can create a bridge DLL which implements all the interfaces but receives native types (char*, something else for vectors and lists) and converts them internally and then sends them to the exe, but that will over complicate things and I'm not completely sure it'll work.

That means that the VC++ 2003 toolkit will live on (it's still available in some places, Baldyr).

As for the SDK problems - I intend to write a new guide for compiling the SDK. It'll be based, of course, on old ones, but I want to simplify it as much as possible.
I have a few ideas (create my own package of everything's needed, create the Visual Studio project myself etc.).
I hope it'll be an improvement. It might just be that you have to go through all the surrounding crap to get the DLL to compile, but in this case I'm optimistic. I just need a few days for it...
 
Asaf, you are, still, my hero. :king:
 
Top Bottom