I always thought that PASCAL (like WINAPI and CALLBACK) is the same as __stdcall (see windefs.h).
But I found other definitions which said that the parameters are pushed left to right. So I want to clarify this:
See for example:
http://msdn.microsoft.com/de-de/library/system.runtime.interopservices.comtypes.callconv(v=vs.110).aspx (http://msdn.microsoft.com/de-de/library/system.runtime.interopservices.comtypes.callconv(v=vs.110).aspx)
http://de.wikipedia.org/wiki/Aufrufkonvention#Pascal (http://de.wikipedia.org/wiki/Aufrufkonvention#Pascal)
http://www.lowlevel.eu/wiki/Aufrufkonventionen#Pascal (http://www.lowlevel.eu/wiki/Aufrufkonventionen#Pascal)
I am engaged in the 'COM in plain C' Artikels from Jeff Glatt in the moment. He uses PASCAL too for the DLL interface of his
COM-objects. I suppose there is a reason!
'PASCAL' is not a C keyword, but a #def.
You'll find it in 'windef.h' line 93 as:
#define PASCAL __stdcall
When using COM you should check in the METHODDATA structure what calling method is used and act consistently on the INVOKE.
The COM used in Jeff Glastt articles generally don't use the INVOKE method of IUNKNOWN.
Quote from: frankie on September 28, 2014, 10:25:17 PM
... use the INVOKE method of IUNKNOWN.
Do you mean the INVOKE method of IDispatch?
That Invoke in IDispatch is for late binding and it is slower / more complicate way to call COM function.
Look here (http://msdn.microsoft.com/en-us/library/windows/desktop/ms221479(v=vs.85).aspx) or here (http://www.codeproject.com/Articles/14037/COM-in-plain-C-Part)
Quote from: TimoVJL on September 30, 2014, 07:24:21 AM
That Invoke in IDispatch is for late binding and it is slower / more complicate way to call COM function.
Look here (http://msdn.microsoft.com/en-us/library/windows/desktop/ms221479(v=vs.85).aspx) or here (http://www.codeproject.com/Articles/14037/COM-in-plain-C-Part)
I know this. But I have never hered of an Invoke methode in IUnknown!
Let's return to the original question!
Are there differnt meanings of calling convention PASCAL?
1. #define __stdcall PASCAL
2. __stdcall (right to left), pascal (left to right) (Wikipedia)
What is CC_PASCAL?
As frankie says, PASCAL is only defined to __stdcall in Win32, in Win64 it is __fastcall.
So calling convention depends are you using x86 or x64.
Look here (http://en.wikipedia.org/wiki/X86_calling_conventions)
This http://msdn.microsoft.com/en-us/library/windows/desktop/ms221058(v=vs.85).aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/ms221058(v=vs.85).aspx) describes CC_PASCAL as an calling convention in an automation (COM) environment. So here is my parallel to Jeff Glatts Artikel.
CC_PASCAL is a 'left to right' pushing call!
Quote from: czerny on September 29, 2014, 10:05:39 PM
Quote from: frankie on September 28, 2014, 10:25:17 PM
... use the INVOKE method of IUNKNOWN.
Do you mean the INVOKE method of IDispatch?
Yes, INVOKE method of IDispatch.
I am very sorry for the inconvenience.