Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CString objects in extension DLL
Message
De
06/08/1998 12:52:10
 
 
À
Tous
Information générale
Forum:
Visual C++
Catégorie:
Microsoft Foundation Classes
Titre:
CString objects in extension DLL
Divers
Thread ID:
00124532
Message ID:
00124532
Vues:
73
I have created an MFC DLL with some objects that I use in other programs. I created the DLL with the wizard in Visual C++ 5.0, and then declared by objects like the following:

class AFX_EXT_CLASS CClientReg : public CDGMsg
{
// Constructors
public:
CClientReg();
CClientReg (const char *chpClientName, struct sockaddr_in ClientIP,
const char *chpRCList);
virtual ~CClientReg();

// Attributes
public:

CString m_strClientName; // name of the client application
struct sockaddr_in m_ClientIP;// IP address of the client's stream socket
// int m_nRCCount; // number of routing codes in the list
CString m_strRCList; // list of routing codes handled by client

// Operations
public:
virtual bool load(); // put the member data into a buffer for sending

};

I can declare objects of this type in my other apps just fine, and the constructors work OK. However, if I try to set the value of one of the string members using the CString operator '=', or using the Format method, I get a "user breakpoint" message (I don't have any breakpoints set), and the TRACE window shows me this:
HEAP[callctrl.exe]: Invalid Address specified to RtlFreeHeap( d40000, 5f4c0b90 )
and the program crashes.
Shouldn't I be able to do something like:
CClientReg regMsg; // this works OK
regMsg.m_strClientName = _T("Client One"); // this crashes

Also, the program runs fine when compiled in 'Debug' mode. It only breaks when running in release mode.

Any ideas?
Thanks
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform