1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

How to compile the DLL

Discussion in 'Civ5 - SDK / LUA' started by DaveMcW, Nov 2, 2012.

  1. croxis

    croxis Chat room op

    Joined:
    Dec 17, 2001
    Messages:
    3,277
    Location:
    Portland, OR, US
    I only have 2008 and 2010 express editions and both failed. I'll try reinstalling 2008 using the link. Edit: It worked
     
  2. Irkalla

    Irkalla ENTP POWWWEEEEEER

    Joined:
    Sep 25, 2012
    Messages:
    1,009
    Location:
    Way down around Vicksburg
    Open the IDE first, then load the project.

    Didn't read, dammit.
     
  3. Horem

    Horem Emperor

    Joined:
    Apr 1, 2010
    Messages:
    1,720
    Location:
    Wales, UK
    Urm do you "have" to have 2008 version installed for this or can it be done okay in 2012 version? I seem to be able to open the 2008 solution okay(load up both dll's) but the 2010 just throw an error at me.
     
  4. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,637
    Location:
    France
    AFAIK 2008 version must be installed.
     
  5. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,519
    Location:
    Near Portsmouth, UK
    I'm using VS 2010, but it refused to compile/link/build unless VS 2008 was also installed
     
  6. Horem

    Horem Emperor

    Joined:
    Apr 1, 2010
    Messages:
    1,720
    Location:
    Wales, UK
    SO basicly need 2008 to compile the dll?

    Also cant find this in any of the 2 vcxproj files:

    <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>

    Are lines 67, 68, 69

    EDIT:

    DelayLoadDLLs Cant find that refrence in ANY of the sourcecode provided. Stumped.
     
  7. DaveMcW

    DaveMcW Deity

    Joined:
    Oct 8, 2002
    Messages:
    6,489
    Delete the CvGameCoreSource folder and start again from step 3.
     
  8. Terradive

    Terradive Warlord

    Joined:
    Jun 4, 2009
    Messages:
    186
    How do you actually import the compiled Dll into modbuddy? Is it a lua script?
     
  9. Drawmeus

    Drawmeus Emperor

    Joined:
    Jul 25, 2007
    Messages:
    1,213
    Got it to build. So all I need to do is grab the .dll that I need, put it in the root of my mod, add the file to the mod, load into VFS, and we're good to go?

    Do I need both .dll files (CvGameCoreDLLFinal Release.dll, CvGameCore_Expansion1.dll) or just one?

    This thread was amazingly helpful, btw, thank you to all involved.
     
  10. rf900

    rf900 Warlord

    Joined:
    Jan 31, 2006
    Messages:
    194
    I may be wrong, but the first one is used in vanilla and the second for G&K. So depending on the source files you change it will update one or the other or both. For example I only changed cpp files in the Expansion project section so only the Expansion DLL get generated.
     
  11. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,637
    Location:
    France
    and only the expansion DLL can be used from a mod.

    the vanilla DLL need to replace the game core file to be loaded.
     
  12. rf900

    rf900 Warlord

    Joined:
    Jan 31, 2006
    Messages:
    194
    Do you know how to write messages to LUA tuner or other method from the cpp code?

    I am going to try this afterwards, will let you know how it goes...

    CvString szError;
    szError.Format("Error1");
    GC.LogMessage(szError.GetCString());
    CvAssertMsg(false, szError);
     
  13. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,519
    Location:
    Near Portsmouth, UK
    You can write to your own log file under the logs sub-directory with code similiar to ...

    place this in a .h file

    Code:
    // Comment this line out to switch off all custom mod logging
    #define CUSTOMLOGDEBUG "CustomMods.log"
    
    // Custom mod logger
    #ifdef CUSTOMLOGDEBUG
    #define CUSTOMLOG(sFmt, ...) {  \
      CvString sMsg;  \
      CvString::format(sMsg, sFmt, __VA_ARGS__);  \
      LOGFILEMGR.GetLog(CUSTOMLOGDEBUG, FILogFile::kDontTimeStamp)->Msg(sMsg.c_str());  \
    }
    #else
    #define	CUSTOMLOG(sFmt, ...) ((void)0)
    #endif
    
    and then in your cpp code, call it like

    Code:
    CUSTOMLOG("Load: %s = %d", szName, iValue);
    
     
  14. mjjepper

    mjjepper Chieftain

    Joined:
    Jan 16, 2012
    Messages:
    29
    I successfully compiled my dll; however it generated thirty or so warnings. I prepared my mod in modbuddy. Added the dll, my xml file, and set "Import into VFS" property to true. When I loaded up my mod the changes were not implemented. The game did run normally.

    Quick question:
    Does a faulty dll cause the game to crash and burn? Or does the faulty dll get scrapped and the original reload?
     
  15. trystero49

    trystero49 Prince

    Joined:
    Apr 30, 2012
    Messages:
    515
    Don't worry about the warnings. I asked this question before and it turns out it's nothing.

    I'm pretty sure that VFS = true a bad .dll results in game failure. You should doublecheck and make sure that the .dll file is named properly, because if it is not then you loaded a .dll into the VFS that the game engine will ignore.
     
  16. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,519
    Location:
    Near Portsmouth, UK
    Note that the default name for the dlls as generate by the build file are NOT the ones the game expects
     
  17. mjjepper

    mjjepper Chieftain

    Joined:
    Jan 16, 2012
    Messages:
    29
    When I get home I will double check. My mod, Adding +% YieldRateModifiers to Specialists, largely copied from the buildings implementation, failed to effect my change. I will have to reread through all of my code. Thanks whoward69 and trystero49.
     
  18. Anvil

    Anvil Chieftain

    Joined:
    Nov 4, 2009
    Messages:
    18
    I followed the guide on the first post, step by step but I am unsure if have have done it correctly. I have attached a picture of my mod buddy screen for review. The DLL files open up to something that does not look like C++ at all. In fact they are just sporadic numbers and letters. Is this correct? Am I meant to edit the dll files or open new files like with xml?

    Also where can I find examples dll files so I can can model existing code. I wish to change the zone of control for navel units does any one have any idea where I can find this code?
     

    Attached Files:

    • dll.jpg
      dll.jpg
      File size:
      278.9 KB
      Views:
      138
  19. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,637
    Location:
    France
    You can't modifiy the DLL with modbuddy, you have to do the modifications before the compilation in visual studio.
     
  20. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,519
    Location:
    Near Portsmouth, UK
    Step 8 - "Start Visual C++ 2008 Express Edition" - you shouldn't be anywhere near ModBuddy!
     

Share This Page