Article View: borland.public.cppbuilder.nativeapi
Article #13990Re: Windows wierdness (SendMessage, Win98, Win2000) repeat
From: david
Date: Tue, 02 Sep 2003 00:45
Date: Tue, 02 Sep 2003 00:45
54 lines
3178 bytes
3178 bytes
Keith <kdopson@sbcglobal.net> wrote:
> Recall that you can #pragma the compiler options at will, or break
> portions of code into other module that have a single particular compiler
> control set.
>
> What I do find interesting about this is that the code generated from your
> app didn't change, but the USER32.SendMessageA action did change.
> This indicates to me that a different version of the
> USER32.SendMessageA function was provided during the link phase, or that
> somewhere in the include files is
> a definition for SendMessageA that can have varying compiled output
> depending on compiler options.
More info: If I declare the routine as:
void __stdcall WinComboBox::add(char * str) { or '_stdcall'
SendMessage(hwndC, CB_ADDSTRING, 0, (LPARAM) str);
}
the error persists. If I try pragma options such as:
#pragma option push -ps
void _stdcall WinComboBox::add(char * str) {
SendMessage(hwndC, CB_ADDSTRING, 0, (LPARAM) str);
}
#pragma option pop
the error still persists. I am assuming that I did that correctly as I have
never used that before. I can get the C calling convention to work by:
void _stdcall WinComboBox::add(char * str) {
int a = 1;
int temp = SendMessage(hwndC, CB_ADDSTRING, 0, (LPARAM) str);
int b = 2;
b += 3;
a += 1;
}
If I remove the 'int temp =' or any of the assignments the program is hosed.
Very interesting, and kinda sickening. Oh. I see what is happening. Flag
CF is set to '1' on the working version, and 0 when it blows up. Evidently
CF is set to 1 whenever there has been stuff added to the stack by the
routine. Evidentally this is accomplished by the compiler inserting a 'add
esp, -0x0c' instruction whenever the compiler sees that stuff has been added
to the stack. So, it is a Borland problem, in that BCB fails to see that
the stack has grown for this simple instruction. If anyone would care to
add this on quality central, as I have never bothered to subscribe, I would
appreciate it.
Thanks,
David
Technical Details
Message-ID:
<3f53cb9c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3F50A23C.1090706@anonymous_one.com> <3F50C002.901B2CC9@sbcglobal.net> <3F5164FE.8000803@anonymous_one.com> <3F519DFF.B2345F35@sbcglobal.net> <3F51A27B.1A59EF47@sbcglobal.net> <3F51B1EE.50203@anonymous_one.com> <3F51F97D.8F17CCFA@sbcglobal.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,d5c2d7b43b5c1d37 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-09-01 15:46:37 PST From: "david" <not_valid@randommonkeyworks.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3F50A23C.1090706@anonymous_one.com> <3F50C002.901B2CC9@sbcglobal.net> <3F5164FE.8000803@anonymous_one.com> <3F519DFF.B2345F35@sbcglobal.net> <3F51A27B.1A59EF47@sbcglobal.net> <3F51B1EE.50203@anonymous_one.com> <3F51F97D.8F17CCFA@sbcglobal.net> Subject: Re: Windows wierdness (SendMessage, Win98, Win2000) repeat Date: Mon, 1 Sep 2003 17:45:51 -0700 Lines: 58 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 NNTP-Posting-Host: 67.30.0.79 Message-ID: <3f53cb9c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1062456220 67.30.0.79 (1 Sep 2003 15:43:40 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail