hello im a bit confused with DLLs right now so i came here to ask where there are alot of pros in programming
so ive got this class called GUI.h and the GUI.cpp
class GUI
{
public:
GUI(void);
virtual ~GUI();
void Draw(float x,float y,float z);
void Texture(int num);
bool Shutdown();
void TextureON(int num);
void TextureOFF(int num);
private:
GUIWeapon * Weapon;
GUIWeaponA * Weapona;
GUIArrow * Arrow;
GUIHP * hp;
GUIStop * stop;
GUISpeed * Speed;
float XCam,YCam,ZCam;
bool DrawStop;
};
so how am i suppossed to export this to a DLL i have made DLLs but not with classes so how am im suppossed to declare the Constructor,Destructor and call the other GUIFunctions in other headers?
You don’t specify a compiler or operating system, but if this is Windows and Microsoft C++, then you can use __declspec(dllexport) on a class to export it from a DLL. You then use __declspec(dllimport) on the same class when you include the header to be consumed elsewhere.
However, I tend to recommend against exporting classes from DLLs. It’s an ok plan if all the DLLs always ship together and are built together. [Where the DLL is just used to delay loading of code]. If you are using DLLs to provide actual components that ship separately, you should use an actual versionable abstraction like COM.
Martyn