DLL confusion
by Daniel Buckmaster · in Torque 3D Professional · 01/20/2012 (11:56 am) · 4 replies
I'll start by saying that I'm not particularly knowledgeable about DLL and LIB linking. Nor compiling them. But as far as I understand, most of the T3D code is in Torque3D.DLL, and there's a very small executable that calls all that code.
Does this mean that for patching purposes, Torque3D.DLL can be replaced independently of Torque3D.exe? Could we then build into the EXE some kind of launcher/patcher that updates the DLL as necessary? To save having a separate updater application.
Does this mean that for patching purposes, Torque3D.DLL can be replaced independently of Torque3D.exe? Could we then build into the EXE some kind of launcher/patcher that updates the DLL as necessary? To save having a separate updater application.
About the author
Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!
#2
01/20/2012 (12:22 pm)
As far as I know the DLL can't be updated independently of the EXE as the two work together. Matt Fairfax would be the one that would know for sure, I'll see if I can steer him this direction.
#3
Meaning, you just need to #define TORQUE_SHARED for the app project and then make modifications to unload the library when its time to update it. Or, to make things a lot easier, check for updates and apply then before loading the Torque DLL upon app program loading. It's been a while since I even bothered to look at that project's main.cpp file and I failed to realize that all the hard work has already been done for you.
So all you need to do is work on your updater code, enjoy! :)
Quick Update: TORQUE_SHARED macro is already defined for you in the app project's Configuration Properties -> C/C++ -> Preprocessor: Preprocessor Definitions field.
01/20/2012 (12:43 pm)
Well isn't that funny, TORQUE_SHARED confusion popped up soon after I posted my reply and what do you know it talks about exactly what I was mentioning about a macro that will switch the non-DLL app project to dynamically load the DLL library on its own instead of using VC++'s automatic handling.Meaning, you just need to #define TORQUE_SHARED for the app project and then make modifications to unload the library when its time to update it. Or, to make things a lot easier, check for updates and apply then before loading the Torque DLL upon app program loading. It's been a while since I even bothered to look at that project's main.cpp file and I failed to realize that all the hard work has already been done for you.
So all you need to do is work on your updater code, enjoy! :)
Quick Update: TORQUE_SHARED macro is already defined for you in the app project's Configuration Properties -> C/C++ -> Preprocessor: Preprocessor Definitions field.
#4
Scott: thanks!
01/20/2012 (1:02 pm)
Nathan: I did see that thread - I didn't understand a word of it, but it prompted me to post this question, which I've been mulling over for a while. My intention was originally to load the updater before the engine itself for simplicity. Now I just need to work out how to make an updater without the luxury of having Torque running!Scott: thanks!
Torque Owner Nathan Martin
TRON 2001 Network
Without source changes, no. You'll need to change the relationship to a runtime dynamically linked library that you have to load and be able to unload yourself on demand. Right now the relationship with the DLL is automatic as when you use the .lib file (done automatically via dependency management in the project properties) for the DLL project as the library is automatically loaded for you by code that runs before main() or winmain() is even called via Visual Studio's linker.
See this wikipedia article on Dynamic Loading for some examples. Additionally any classes or function calls that the non-DLL project uses to access the DLL's functions or classes will have to be done differently to support the on demand loading of the library as the class and function pointers won't be available automatically to you in this case.