hi there,
i'm not that experienced with dll's... so please bear with me on this one... basically i have a design question for you...
the scenario is this: i have a library that i want to distribute to someone as a dll, so they can use part of the functionality of the library... but only a very small part of it... so what i planned to do is have a wrapper around one class in the library that would allow limited access to a single class in the library...
this is a basic example of how i thought i could do it:
Code:
/////////////////////////////////////////////////////////
//the original library class
class SpecialImage
{
public:
SpecialImage();
~SpecialImage();
int openSpecialImage(char* filename);
int getSpecialImageColour(int x, int y);
private:
Image image;
int special_number;
};
/////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
//the exported dll 'wrapper' class
#include "SpecialImage.h"
class class __declspec(dllexport) ExportedSpecialImage
{
public:
ExportedSpecialImage();
~ExportedSpecialImage();
int openExportedSpecialImage(char* filename);
int getExportedSpecialImageColour(int x, int y);
private:
SpecialImage* special_image;
};
///and in the ExportedSpecialImage.cpp
ExportedSpecialImage::ExportedSpecialImage()
{
special_image = NULL;
}
ExportedSpecialImage::~ExportedSpecialImage()
{
if(special_image!=NULL)delete special_image;
}
int ExportedSpecialImage::openExportedSpecialImage(char* filename)
{
specialImage->openSpecialImage(filename);
}
int ExportedSpecialImage::getExportedSpecialImageColour(int x, int y)
{
return special_image->getSpecialImageColour(x, y);
}
/////////////////////////////////////////////////////////
the problem is that in my ExportedSpecialImage.h file, i need to import the 'SpecialImage.h" and i also have a member variable of type 'SpecialImage'... which would mean i could not just send the .dll and 'ExportedSpecialImage.h'.... i would also have to send 'SpecialImage.h'.... and whatever header files it depends on.... wouldn't I?? so basically i want to limit the exposure of 'SimpleImage' somehow....
so that's my dilemma... how to do this 'wrapper' class... without exposing anymore of the library than necessary...? does that make any sense?
it may be that i am just being stupid... but i can't figure out how to do this one.... any help/thoughts greatly appreciated!! thanks.