General information
Category:
Microsoft Foundation Classes
I just had the same problem (last week) and the solution was to turn off all optimizations (in the project settings) for the dll. It worked for me, but I still don't know what was the real problem (or which optimization creates the problem) because I had no time to look at it closer. Please let me know if you find more details about it.
Vlad
>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
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only