Hey there!
I am writing a library which has to have a static class (or a singleton) and i am having troubles figuring how's that done.
I have declared my class in a header file, made it static and, where i am using it, i specify the "extern" modifier to the variable, and everithing is OK.
The problem is that, when i am linking the library to another project, i find out that, the constructor for the library really gets called about 15 times, so i am a bit confused about this. I am getting the feeling that an instance of the class was created whenever the header file in which is declare is included in another file, although i specified the #ifndef _this_header_file_blah_blah... stuff.
So, could somebody point me in the right direction of doing this?
Thank you! [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
I am writing a library which has to have a static class (or a singleton) and i am having troubles figuring how's that done.
I have declared my class in a header file, made it static and, where i am using it, i specify the "extern" modifier to the variable, and everithing is OK.
The problem is that, when i am linking the library to another project, i find out that, the constructor for the library really gets called about 15 times, so i am a bit confused about this. I am getting the feeling that an instance of the class was created whenever the header file in which is declare is included in another file, although i specified the #ifndef _this_header_file_blah_blah... stuff.
So, could somebody point me in the right direction of doing this?
Thank you! [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro