Click here to Skip to main content
16,007,858 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Singleton template and dll Pin
led mike4-Dec-06 5:48
led mike4-Dec-06 5:48 
GeneralRe: Singleton template and dll Pin
Cedric Moonen4-Dec-06 8:03
Cedric Moonen4-Dec-06 8:03 
GeneralRe: Singleton template and dll Pin
led mike4-Dec-06 9:06
led mike4-Dec-06 9:06 
GeneralRe: Singleton template and dll Pin
Cedric Moonen4-Dec-06 9:25
Cedric Moonen4-Dec-06 9:25 
GeneralRe: Singleton template and dll Pin
led mike4-Dec-06 11:00
led mike4-Dec-06 11:00 
GeneralRe: Singleton template and dll Pin
Cedric Moonen4-Dec-06 20:15
Cedric Moonen4-Dec-06 20:15 
GeneralRe: Singleton template and dll Pin
led mike5-Dec-06 6:03
led mike5-Dec-06 6:03 
GeneralRe: Singleton template and dll Pin
Cedric Moonen5-Dec-06 20:31
Cedric Moonen5-Dec-06 20:31 
led mike wrote:
Well I added that new twist of the exported function but I still cannot reproduce your problem


That's strange... What IDE are you using ? I'm working with VC2005 Express.


led mike wrote:
I don't understand why you need an exported function that just returns a pointer to an instance but that's just me.


The reasons are multiple:
- First, I want to force the user to specify some parameters (like the screen size, and several other configurations). If I use several public function to do that it is not clean: some parameters are mandatory and I don't want the user to call 3 or 4 functions to initialize the engine. You said that I could add parameters to the static getInstance: that's quite bad. What happen if in my code, I want to access the unique instance ? I'll need to pass some parameters again ? That's not clean at all.
Remember that I want it the easiest to use for the end user.

- Second, I would like the user to work with interfaces only (so, pure abstract classes only) so, the Create function will in fact instanciate a CEngine class and returns an interface.

- I would like to have this code compile for several platforms (at least for windows and Linux), so having a DLL binary for windows and a 'dynamic library' (I don't remember the extension) for Linux based on exactly the same code. I know for sure that gcc can export functions, but I don't know if it can export classes.

- It could be interesting to have this dll to be explicitely linkable (so, using LoadLibrary and GetProcAddress). If you export classes, you can only use implicit linking (that is, using the lib file provided with the dll).

- I would like in the future that the dll can be used in other languages (for example in .NET). I don't know exactly how I will do that but I know more or less how COM components work: they have a global exported function that creates an instance of a class and returns an interface to this class. So, being able to use this dll in other language will require only to rewrite the interfaces.

So, there are several reasons why I want to keep this design.
Anyway, thanks for your help. I hope I'll find a solution to that problem.


Cédric Moonen
Software developer

Charting control [v1.1]

GeneralRe: Singleton template and dll Pin
led mike6-Dec-06 6:10
led mike6-Dec-06 6:10 
GeneralRe: Singleton template and dll Pin
Cedric Moonen6-Dec-06 8:11
Cedric Moonen6-Dec-06 8:11 
GeneralRe: Singleton template and dll Pin
Rick York1-Dec-06 10:25
mveRick York1-Dec-06 10:25 
GeneralRe: Singleton template and dll Pin
CPallini1-Dec-06 10:32
mveCPallini1-Dec-06 10:32 
QuestionEnumerate DLL Exports Pin
peterchen1-Dec-06 3:46
peterchen1-Dec-06 3:46 
AnswerRe: Enumerate DLL Exports Pin
Mike Dimmick1-Dec-06 4:24
Mike Dimmick1-Dec-06 4:24 
GeneralRe: Enumerate DLL Exports Pin
peterchen1-Dec-06 5:08
peterchen1-Dec-06 5:08 
QuestionWindows class not created error? Pin
TheDelChop1-Dec-06 3:08
TheDelChop1-Dec-06 3:08 
QuestionRe: Windows class not created error? Pin
CPallini1-Dec-06 3:15
mveCPallini1-Dec-06 3:15 
AnswerRe: Windows class not created error? Pin
TheDelChop1-Dec-06 3:17
TheDelChop1-Dec-06 3:17 
GeneralRe: Windows class not created error? Pin
CPallini1-Dec-06 6:26
mveCPallini1-Dec-06 6:26 
GeneralRe: Windows class not created error? Pin
TheDelChop1-Dec-06 7:26
TheDelChop1-Dec-06 7:26 
GeneralRe: Windows class not created error? Pin
CPallini1-Dec-06 7:35
mveCPallini1-Dec-06 7:35 
GeneralRe: Windows class not created error? Pin
TheDelChop1-Dec-06 7:37
TheDelChop1-Dec-06 7:37 
AnswerRe: Windows class not created error? Pin
Mark Salsbery1-Dec-06 7:44
Mark Salsbery1-Dec-06 7:44 
AnswerRe: Windows class not created error? Pin
Mark Salsbery1-Dec-06 8:09
Mark Salsbery1-Dec-06 8:09 
QuestionTimer Event Pin
braune1-Dec-06 2:00
braune1-Dec-06 2:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.