I was asking recently the following question (thanks to Warren Vick and Bo Thomsen for 
their input !)

"I am creating DLLs in VC++, to be called from MB.
By default, the argument uses the __cdecl argument passing convention (caller pops the 
stack).
Is this OK or should I use __stdcall (the Pascal convention, called function pops the 
stack)."

I need to add a few more info:

1) The DLLs are supposed to be accessible from MB, VB(A), C/C++ etc...

2) VBA cannot use DLLs with the __cdecl calling convention (Knowledge Base Article 
213554): this leads to error 49, "Bad DLL calling convention"; __stdcall is required 
(which is the case for most 32 bits DLL included with Windows).

3) The MB user guide says (chapter 10) nothing about whether __stdcall or __cdecl 
should be used, only to not use __fastcall. It does not say that MB (caller) is able 
to pop the stack; if not properly done, this is likely lead to problems at some time.

So my present conclusion is that __stdcall is required. Problem is that this 
convention leads to name decoration (name is postfixed with @ and number of bytes for 
arg list). A VC++ DEF file is thus required to get the proper final name. Still 
investigating on this.


Pierre Henrotay
Siemens Information and Communications
Siemens Business Services s.a./n.v.


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 4412

Reply via email to