Pierre - You'll have to use the __stdcall calling convention when creating dll's to MapBasic.
When you use __cdecl you leave the "stack-cleaning" duties to the _calling_ program. If you use __stdcall, "stack-cleaning" duties falls on the called dll. That means, that using __cdecl based dll's when MapBasic expects __stdcall based dll's leaves passed argument on the stack after termination of the dll function. It works for a while.. until the stack is filled with garbarge. Then .. BOOM - mysterious error appears... I spent a week chasing the same kind of error (although using Delphi..) regards Bo Thomsen GeoConsult -----Oprindelig meddelelse----- Fra: HENROTAY PIERRE [mailto:[EMAIL PROTECTED]] Sendt: 3. december 2002 17:24 Til: '[EMAIL PROTECTED]' Emne: MI-L DLLs and MapBasic: calling convention ? 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 have examples for both but am not certain of the result. It seems that from VB, the functions work fine whatever convention is used (???) but that for using the DLLs from other VC++ programs, it is easier to stick to __cdecl. TIA for any hint. Pierre Henrotay Siemens Information and Communications Siemens Business Services s.a./n.v. Consult Design Build Rue de N�verl�e 11 B5020 Namur (Rhisnes) Belgium Tel. ++ 32 81 559 687 Fax ++ 32 81 559 658 Mobile ++ 32 477 69 93 19 mailto:[EMAIL PROTECTED] http://www.siemens.be/ic --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 4390 --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 4394
