About Store Forum Documentation Contact



Post Reply 
using DLL
Author Message
kiavash2k Offline
Member

Post: #1
using DLL
Hi there,

I have a serious problem with the engine. I want to separate my game levels from the main .exe . The problem is that I will use Esenthel functions in the dlls (that means that I should link the dll with Esenthel.lib) and when I load the dll into the exe there will be more instance of the engine and all the global defined variables like Game::World, D, Paks and etc. are cloned and they do not relate to each other. I was wondering if there is a way that I could use Esenthel function from a dll and not invoking the InitPre and all the initialization stuff and not cloning the basic functionality.

Thanks in advance
11-28-2011 09:17 AM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #2
RE: using DLL (urgent)
this is a bit complicated if you ask me. You could make your main Game.dll export Game::World, D and others. Level.dll should import them from Game.dll, this should do the trick i think
11-28-2011 09:43 AM
Find all posts by this user Quote this message in a reply
kiavash2k Offline
Member

Post: #3
RE: using DLL (urgent)
I can supply the World, D, and other stuff but the problem is that even if I do that, It will initialize it's own context, it's own windows and it's own Application object.
11-28-2011 10:22 AM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #4
RE: using DLL (urgent)
thats why you should use esenthel headers but not link to esenthel lib in Level.dll
11-28-2011 11:26 AM
Find all posts by this user Quote this message in a reply
kiavash2k Offline
Member

Post: #5
RE: using DLL (urgent)
There's no dll version of Esenthel so what should I link with the dll in the link time for the imported headers ?!!!
It won't compile !!!
(This post was last modified: 11-28-2011 12:14 PM by kiavash2k.)
11-28-2011 12:14 PM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #6
RE: using DLL (urgent)
there is tutorial how to put your game code to the dll. so you do that, then export esenthel symbols. or if you wanted to be hackish you could just export symbols straight in exe, and make your Level.dll import game.exe. I never actually tried this method, but i have seen executables exporting functions so there is no need for this method to not work. afterall difference between exe and dll is just an entry point function.
11-28-2011 02:33 PM
Find all posts by this user Quote this message in a reply
Abril Offline
Member

Post: #7
RE: using DLL (urgent)
(11-28-2011 09:17 AM)kiavash2k Wrote:  Hi there,

I have a serious problem with the engine. I want to separate my game levels from the main .exe . The problem is that I will use Esenthel functions in the dlls (that means that I should link the dll with Esenthel.lib) and when I load the dll into the exe there will be more instance of the engine and all the global defined variables like Game::World, D, Paks and etc. are cloned and they do not relate to each other. I was wondering if there is a way that I could use Esenthel function from a dll and not invoking the InitPre and all the initialization stuff and not cloning the basic functionality.

Thanks in advance

Have a look in the EE sdk at this project:

Extra\Tutorial - Loading Game from DLL
11-28-2011 03:24 PM
Find all posts by this user Quote this message in a reply
kiavash2k Offline
Member

Post: #8
RE: using DLL
I know how to put the whole game into a DLL and I have read Extra\Tutorial - Loading Game from DLL.
The problem is that I want to seperate main exe code from level codes and in the level codes I will be using Esenthel function which requires linking it with Esenthel.lib which will invoke the initialization stuff ( InitPre, building Application object and all the global variables and ...). I don't think that it will be possible to link a dll with .exe and I don't think if I can build my game in a dll and link all my Esenthel projects with that DLL. Cause I can't make it export all it's symbols so I should do that manually which doesn't look practical to add __declspec(dllexport) to all the classes and functions.
11-29-2011 05:29 AM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #9
RE: using DLL
if you "dont think" then means you dont know enough about how software works at lower level. It can be done. Good thing about esenthel engine is that its api is object oriented, so __declspec(dllexport) class Image should export whole Image class. About it being practical - it is not practical to fix bugs in game server binary while you do not have source code of the server, however people do this stuff, some people even built a business based on this method, which is very impractical.. You should not be afraid of doing crazy stuff, because if it works - you are fucking awesome, and if if it fails - you learn shit, and if you run away because it "seems impractica" then.. how far are you willing to go in software development anyway, let alone innovation in general.. smile
11-29-2011 01:26 PM
Find all posts by this user Quote this message in a reply
Post Reply