DangCongWei
June 11th, 1999, 05:43 AM
Hello :
I used a CSocket object for sending data in a thread object
(a instance of a class derived from CThread). If I selected "Using
MFC in a shared DLL", everything would go correctly. But
If I selected "Using MFC in a static library", the program
would crash when creating the CSocket object. Part of codes
is as following :
1. Create the thread :
CSendDataThread sendThread ; // CSendDataThread is derived from CThread
sendThread.CreateThread () ; // create thread
2. Initialize the thread :
BOOL CSendDataThead::InitInstance ()
{
CSocket s ;
s.Create () ; // here crash !
...
...
return TRUE ;
}
I traced the sorce code in MFC and found that the code try to
access a varible in a CMapPtrToPtr object (perhaps it was not "new"ed
yet or had already been "delete"ed.) But, what puzzled me mostly, when using
dynamic linking MFC, all would run smoothly. Anyone help me?
Best Regards !
-- Dang --
I used a CSocket object for sending data in a thread object
(a instance of a class derived from CThread). If I selected "Using
MFC in a shared DLL", everything would go correctly. But
If I selected "Using MFC in a static library", the program
would crash when creating the CSocket object. Part of codes
is as following :
1. Create the thread :
CSendDataThread sendThread ; // CSendDataThread is derived from CThread
sendThread.CreateThread () ; // create thread
2. Initialize the thread :
BOOL CSendDataThead::InitInstance ()
{
CSocket s ;
s.Create () ; // here crash !
...
...
return TRUE ;
}
I traced the sorce code in MFC and found that the code try to
access a varible in a CMapPtrToPtr object (perhaps it was not "new"ed
yet or had already been "delete"ed.) But, what puzzled me mostly, when using
dynamic linking MFC, all would run smoothly. Anyone help me?
Best Regards !
-- Dang --