Article View: borland.public.cppbuilder.nativeapi
Article #3810Re: AV - Stack getting trashed - HELP!
From: Remy Lebeau (TeamB)
Date: Tue, 25 Apr 2006 17:04
Date: Tue, 25 Apr 2006 17:04
31 lines
2072 bytes
2072 bytes
"Borland Lover" <kdhf@kbdf.com> wrote in message
news:444e4463$1@newsgroups.borland.com...
> GetAdaptersInfo - it does not specify a calling convention
> in the MSDN.
As I told you earlier, *all* Win32 API functions use WINAPI (aka __stdcall),
except for wsprintf() which uses __cdecl instead. If you look in
iphlpapi.h, where GetAdaptersInfo() is actually declared, you can see that:
DWORD
WINAPI // <-- here
GetAdaptersInfo(
PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen
);
> UuidCreateSequential - it specifies RPC_ENTRY. What do I use in BCB?
You use RPC_ENTRY, which transparently maps to __stdcall. Always use what
is actually in the declaration.
> I am loading and calling both right now without specifying the calling
> convention - and they seem to be working fine. Is this a fluke?
Yes. You must always specify a calling convention, or else the compiler is
free to choose its own. As you have already seen earlier, the compiler can
chose the wrong convention and mess up the runtime behavior as a result.
Gambit
Technical Details
Message-ID:
<444e5734$3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4449633f$1@newsgroups.borland.com> <444d1d06$1@newsgroups.borland.com> <444e4463$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,aeca86a831696bee X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4449633f$1@newsgroups.borland.com> <444d1d06$1@newsgroups.borland.com> <444e4463$1@newsgroups.borland.com> Subject: Re: AV - Stack getting trashed - HELP! Date: Tue, 25 Apr 2006 10:04:27 -0700 Lines: 33 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <444e5734$3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1145984820 68.69.17.41 (25 Apr 2006 10:07:00 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail