View Full Version : Storing Classes
03-26-2003, 06:04 PM
I'm thinking of making classes to take care of the mundane work of having to set up the basic OpenGL scene over and over again and creating the window over again and what not. However, I'm wondering if it is best to store them in a dll or a static library. I'm thinking dll because it would be easier to update everything.
But i'm wondering if I have to do anything special if i have my class in the dll. I know that in the dll if you have functions, you have to use 'extern'. Do you have to do that in a dll? Or can you just code the class like you would in a static library.
03-27-2003, 02:23 AM
You need to export all functions/variables/... that you want to be able to reach from outside the dll, you do this by putting them in a .def file or (with VC and MingW) using __declspec( dllexport) whatever_you_want_to_export...
03-27-2003, 04:38 AM
we use a static library for our engine. just cause it's easier for a developer to create his own game by deriving specific classes from our base engine classes.
03-27-2003, 06:18 AM
That's true that static libraries are much much easier for the developer to use, but what happens when you update the engine? It would be really arduous to update all the applications ever created with that engine. With a DLL, you can probably just replace one dll in the system directory, and you are set to go.
Well i'm used to the _dclspec(dllexport) for functions and what not, but...what about classes? My library would be a collection of classes, and probably no functions. I know that if you want to dynamically load in each of the classes, you have to make functions to return new instances and what not. But i just want to be able to link to it and use the classes. Would i have to do anything special in that case? This way it would be like using a static library, but the classes would be in a dll and it would be easy to load.
Appreciate the replies guys!
Edit: Forgot to mention this: If you have a dll and have say 10 apps that use it, you would use much less HD space than if you had 10 apps linked to a static library. I mean all the user has to do is still link to the .lib file created when you compile the dll right?
[This message has been edited by HalcyonBlaze (edited 03-27-2003).]
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.