Game Engine Export
Hi,
I'm not sure this is the right forum to post this, but I'm starting to work on a game engine using c++ and opengl and I woud like to export it as a dll.
How the best way to do that (in vstudio 2008)?
Thank you,
Rosália
Set the project type to DLL in the project options. You'll also need to start using declspec(dllexport) or build a export definition file. For future reference, an excellent place for documentation about using Visual Studio is MSDN. For example, you can find this by typing "creating a DLL in visual studio" in the search box.
Why do you want to do this? It can be more trouble than it is worth.
Why do you want to do this? It can be more trouble than it is worth.
Hi,
I did take a look on MSDN, but I was wondering wheter a Class Library would fit better than a Win32 DLL.
I want to do it because I'm using this "game engine" in many projects, and I believe this is a way to make it more organized. Also, it is something I'll have to learn one day, than why not now? :)
I'll take a look at the link you provided, thank you,
Rosália
I did take a look on MSDN, but I was wondering wheter a Class Library would fit better than a Win32 DLL.
I want to do it because I'm using this "game engine" in many projects, and I believe this is a way to make it more organized. Also, it is something I'll have to learn one day, than why not now? :)
I'll take a look at the link you provided, thank you,
Rosália
Quote:
I want to do it because I'm using this "game engine" in many projects, and I believe this is a way to make it more organized
A static library will work just as well, and be far easier to deal with.
Quote:Original post by Rosalia
Hi,
I'm not sure this is the right forum to post this, but I'm starting to work on a game engine using c++ and opengl and I woud like to export it as a dll.
How the best way to do that (in vstudio 2008)?
Thank you,
Rosália
I agree with jpetrie a static library is the way to go for what you want, I've never made a static library but here is how to export a basic function with a dynamic library:
extern "C" __declspec(dllexport) float add(float a, float b){ return a + b;}
extern "C" tells the compiler to export the function names without the signature data since C++ function names are mangled, to use c++ functions you would need to know their mangled names which are basically random hash that different compilers use to represent the signature information.
__declspec(dllexport) exports the function from the DLL, there is not much else to it.
Personally for my engine I use lua scripting language but my goals are a little bit different than yours.
I'm not sure if that will help you but I'm bored right now and thought I would try to make the learning process a little bit easier for you.
If you are going the DLL route then what SteveDeFacto said is correct. Rather than exporting a whole heap of functions, you might want to expose a single function that returns a structure which contains function pointers to the rest of the functionality. This is what older game engines such as Quake (pre-3) and Half-Life do to expose inter-module functionality. On a side note, it is also often this specific technique that cheaters target to gain access to engine functionality.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement