Click here to Skip to main content
15,916,091 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Access violation iin SendMessage Pin
KingsGambit22-Dec-09 0:17
KingsGambit22-Dec-09 0:17 
AnswerRe: Access violation iin SendMessage Pin
Maximilien22-Dec-09 0:22
Maximilien22-Dec-09 0:22 
GeneralRe: Access violation iin SendMessage Pin
Anu_Bala22-Dec-09 0:48
Anu_Bala22-Dec-09 0:48 
GeneralRe: Access violation iin SendMessage Pin
CPallini22-Dec-09 1:35
mveCPallini22-Dec-09 1:35 
Questionsh_read: Undeclared identifier Pin
Anu_Bala21-Dec-09 22:37
Anu_Bala21-Dec-09 22:37 
AnswerRe: sh_read: Undeclared identifier Pin
KingsGambit21-Dec-09 23:06
KingsGambit21-Dec-09 23:06 
GeneralRe: sh_read: Undeclared identifier Pin
Anu_Bala21-Dec-09 23:12
Anu_Bala21-Dec-09 23:12 
Questionerror C2487 Pin
Nandu_77b21-Dec-09 22:33
Nandu_77b21-Dec-09 22:33 
error C2487: 'CSingleton<T>::ms_pSingleton' : member of dll interface class may not be declared with dll interface


When I try to compile the below code in VS2008 above is the error. I am not sure hw to fix this, as the class is not exported (i am getting this error even when i try to export the member alone).

So please suggest me a better solution.


template <typename T>
class CSingleton
{
private:
ExportSlotCoreLib static T* ms_pSingleton;

CSingleton(const CSingleton&);

protected:
CSingleton() {
//assert(ms_pSingleton == NULL);
int offset = (char*)(T*)1 - (char*)(CSingleton <T>*)(T*)1;
ms_pSingleton = reinterpret_cast<T*>(reinterpret_cast<char*>(this) + offset);
}

~CSingleton() {
//assert(ms_pSingleton != NULL);
ms_pSingleton = NULL;
}

public:
static T& GetSingleton() {
return (T&)*ms_pSingleton;
}

static T* GetSingletonPtr() {
return ms_pSingleton;
}

};

Thanks,
Nandu
AnswerRe: error C2487 Pin
KingsGambit21-Dec-09 23:10
KingsGambit21-Dec-09 23:10 
QuestionRe-Mssql question Pin
MsmVc21-Dec-09 20:28
MsmVc21-Dec-09 20:28 
AnswerRe: Re-Mssql question Pin
Code-o-mat21-Dec-09 21:00
Code-o-mat21-Dec-09 21:00 
GeneralRe: Re-Mssql question Pin
MsmVc21-Dec-09 21:05
MsmVc21-Dec-09 21:05 
GeneralRe: Re-Mssql question Pin
Code-o-mat21-Dec-09 21:13
Code-o-mat21-Dec-09 21:13 
GeneralRe: Re-Mssql question Pin
MsmVc21-Dec-09 21:17
MsmVc21-Dec-09 21:17 
GeneralRe: Re-Mssql question Pin
Code-o-mat21-Dec-09 22:01
Code-o-mat21-Dec-09 22:01 
GeneralRe: Re-Mssql question Pin
MsmVc21-Dec-09 22:04
MsmVc21-Dec-09 22:04 
GeneralRe: Re-Mssql question Pin
Code-o-mat21-Dec-09 22:40
Code-o-mat21-Dec-09 22:40 
AnswerRe: Re-Mssql question Pin
CPallini21-Dec-09 21:53
mveCPallini21-Dec-09 21:53 
GeneralRe: Re-Mssql question Pin
MsmVc21-Dec-09 21:56
MsmVc21-Dec-09 21:56 
QuestionRe: Re-Mssql question Pin
PCuong198321-Dec-09 21:58
professionalPCuong198321-Dec-09 21:58 
AnswerRe: Re-Mssql question Pin
MsmVc21-Dec-09 22:05
MsmVc21-Dec-09 22:05 
GeneralRe: Re-Mssql question Pin
PCuong198321-Dec-09 23:12
professionalPCuong198321-Dec-09 23:12 
GeneralRe: Re-Mssql question Pin
MsmVc21-Dec-09 23:18
MsmVc21-Dec-09 23:18 
GeneralRe: Re-Mssql question Pin
PCuong198322-Dec-09 3:55
professionalPCuong198322-Dec-09 3:55 
Questionneed delete a file in vc++ Pin
kamalilam21-Dec-09 20:04
kamalilam21-Dec-09 20:04 

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.