Click here to Skip to main content
15,918,889 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralEasier way to convert this..... Pin
RobJones8-Sep-03 8:52
RobJones8-Sep-03 8:52 
GeneralRe: Easier way to convert this..... Pin
Alvaro Mendez8-Sep-03 9:15
Alvaro Mendez8-Sep-03 9:15 
GeneralRe: Easier way to convert this..... Pin
godbert8-Sep-03 14:16
godbert8-Sep-03 14:16 
GeneralgetItemData() in CTreeCtrl Pin
Binayak8-Sep-03 8:21
Binayak8-Sep-03 8:21 
GeneralRe: getItemData() in CTreeCtrl Pin
RChin8-Sep-03 10:02
RChin8-Sep-03 10:02 
GeneralWinsock- handling multple clients Pin
Scozturk8-Sep-03 8:16
professionalScozturk8-Sep-03 8:16 
GeneralRe: Winsock- handling multple clients Pin
valikac8-Sep-03 9:43
valikac8-Sep-03 9:43 
GeneralStack messed up upon function returned Pin
DionChen8-Sep-03 8:03
DionChen8-Sep-03 8:03 
Hi, all:

I have a weird problem and need your help. I have a main app and DLL. In the main app I have my object pointer (CMyObj* pObj) that has method like:

HRESULT TranslateIDToName( long lID, LPSTR cBuff, UNIT dwBuffSize );

this TranslateIDToName then calls some methods in DLL.

In main, I have something like this:

const DWORD dwBuffSize = 128;
TCHAR cBuff[dwBuffSize];
pObj->TranslateIDToName( lID, cBuff, dwBuffSize );

When I compile both main app and DLL in RELEASE, (both uses Multithreaded DLL as Runtime DLL ). It works fine! However, if I compile both in Debug ( both uses Debug Multithreaded DLL ), I step through the code, The TranslateIDToName() fills up the cBuff correctly and then return from the function.

The problem comes when the function returns to the caller:

pObj->TranslateIDToName( lID, cBuff, dwBuffSize );

The pObj is trashed with either garbage in the pObj or pObj = NULL. In either case, the pObj address changes before calling the method and right after return from the method ( the Stack really messed up!!). Of course, the app crashes!

I tried all the stuff I can think of, and no more ideas about what could be wrong.

Any suggestion and help will be highly appreciated. Thanks in advance.

Dion

GeneralRe: Stack messed up upon function returned Pin
valikac8-Sep-03 9:46
valikac8-Sep-03 9:46 
GeneralRe: Stack messed up upon function returned Pin
DionChen8-Sep-03 9:49
DionChen8-Sep-03 9:49 
GeneralAnalyzing traffic / protocols Pin
L.Denninger8-Sep-03 8:02
L.Denninger8-Sep-03 8:02 
GeneralRe: Analyzing traffic / protocols Pin
Peter Weyzen8-Sep-03 10:41
Peter Weyzen8-Sep-03 10:41 
GeneralRe: Analyzing traffic / protocols Pin
Led8-Sep-03 10:52
Led8-Sep-03 10:52 
GeneralRe: Analyzing traffic / protocols Pin
Peter Weyzen8-Sep-03 10:56
Peter Weyzen8-Sep-03 10:56 
GeneralRe: Analyzing traffic / protocols Pin
Peter Weyzen8-Sep-03 11:01
Peter Weyzen8-Sep-03 11:01 
GeneralRe: Analyzing traffic / protocols Pin
Led8-Sep-03 11:20
Led8-Sep-03 11:20 
GeneralRe: Analyzing traffic / protocols Pin
SatyaDY8-Sep-03 19:16
SatyaDY8-Sep-03 19:16 
GeneralString Conversion Pin
Frank Deo8-Sep-03 6:53
Frank Deo8-Sep-03 6:53 
GeneralRe: String Conversion Pin
Dominik Reichl8-Sep-03 7:01
Dominik Reichl8-Sep-03 7:01 
GeneralRe: String Conversion Pin
David Crow8-Sep-03 7:19
David Crow8-Sep-03 7:19 
GeneralRe: String Conversion Pin
Frank Deo8-Sep-03 7:38
Frank Deo8-Sep-03 7:38 
Generalmultiple return values Pin
manusha8-Sep-03 6:45
manusha8-Sep-03 6:45 
GeneralRe: multiple return values [C#] Pin
Dominik Reichl8-Sep-03 7:04
Dominik Reichl8-Sep-03 7:04 
GeneralUDP client implementation Pin
NewHSKid8-Sep-03 6:39
NewHSKid8-Sep-03 6:39 
GeneralRe: UDP client implementation Pin
geo_m9-Sep-03 7:40
geo_m9-Sep-03 7:40 

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.