Sign in to follow this  

Game Engine Export

This topic is 2830 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 2830 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this