comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Pascal Calling Convention
Date: Wed, 23 Mar 2011 19:24:41 -0500
Date: 2011-03-23T19:24:41-05:00	[thread overview]
Message-ID: <ime30d$rrk$1@munin.nbi.dk> (raw)
In-Reply-To: op.vstkpc1rule2fv@index.ici

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3175 bytes --]

"Yannick Duch�ne (Hibou57)" <yannick_duchene@yahoo.fr> wrote in message 
news:op.vstkpc1rule2fv@index.ici...
Le Wed, 23 Mar 2011 22:37:55 +0100, Shark8 <onewingedshark@gmail.com> a
�crit:
...
>> The problem comes with the conventions... I'd like to be able to
>> interface w/o using stdcall or cdecl calling convention and directly
>> use the Pascal calling convention within my Ada texts. According to
>> this page ( 
>> http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/Stdcall-Calling-Convention.html
>> ) the STDCALL convention *is* the Pascal calling convention; both are
>> callee clean-up of the stack however, according to wikipedia (and
>> http://www.swissdelphicenter.ch/torry/showcode.php?id=1233 ) there is
>> a difference: left-to-right vs. right-to-left parameter passing.
>As Delphi is Windows only, I suppose you want the Windows API calling 
>convention (tell me if I'm wrong). On Windows, this is 1) Parameters 
>pushed from right to left : like C 1) The callee clean the stack : like 
>Pascal. This is not the same as the Pascal calling convention, which push 
>parameters from left to right. I believe GNU docs is wrong here, when it 
>says the Pascal calling convention is the calling convention for Windows 
>API (wrong on both sides).

This is news to me, and I wrote the pragma Import support in Janus/Ada. 
Parameter passing in all of the Windows conventions (including C!) is 
left-to-right. But perhaps whomever wrote that was confused by the fact that 
the x86 stack grows downward, so the left parameter is the one at the 
highest address on the stack. Even so, it is the first one pushed.

In any case, the Microsoft Pascal calling convention eventually because 
StdCall, and neither is substantially different than what is done in Ada. 
I'd expect that Delphi uses the same calling convention or something pretty 
similar. So I'd probably just try it to see.

(Of course, if you wanted to *buy* a compiler, it probably would not be hard 
to provide real Delphi support in Janus/Ada. But of course that isn't 
happening without customers, and I'm sure the same is true for GNAT.)

                                   Randy.


I never owned a Delphi compiler, so I could not tell for Delphi proper
object files.

> This could also be a good nugget of information if I decide to use BP7
> to write an OS loader & runtime for that OS; I had an OS written in
> BP7 to the point where it could display a command-line, read
> [keyboard] commands, and change the display-mode... when trying to
> port that code to Ada apparently it failed to load properly due to the
> non-existent runtime's requirement.
The Borland Pascal 7 runtime was/is simple enough; there should be a way
to emulate it on top of the Ada runtime, which is more complete.

> {True, it would be limited to 32-bits; but there isn't going to be a
> shortage of 32-bit CPUs for a while.}
I hope too they will live for a long time again  (I don't want to see
millions of machines discharged and thrown away to Africa).


-- 
Si les chats miaulent et font autant de vocalises bizarres, c'est pas pour
les chiens.
" c++; /* this makes c bigger but returns the old value */ " [Anonymous] 





  reply	other threads:[~2011-03-24  0:24 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 21:37 Pascal Calling Convention Shark8
2011-03-23 23:25 ` Yannick Duchêne (Hibou57)
2011-03-24  0:24   ` Randy Brukardt [this message]
2011-03-24  0:43     ` Yannick Duchêne (Hibou57)
2011-03-24  2:04       ` Shark8
2011-03-25 15:40         ` Yannick Duchêne (Hibou57)
     [not found]       ` <F8mdnYCca6tRJBfQnZ2dnUVZ_s-dnZ2d@earthlink.com>
2011-03-24 19:20         ` Keith Thompson
2011-03-25 16:04           ` Robert A Duff
2011-03-25 17:02             ` Hyman Rosen
2011-03-25 17:09               ` Robert A Duff
2011-03-25 17:35                 ` Hyman Rosen
2011-03-26 19:51                   ` Robert A Duff
2011-03-25 17:51             ` Keith Thompson
2011-03-26 20:46               ` Robert A Duff
2011-03-27  2:24                 ` Randy Brukardt
2011-03-28 15:41                   ` Adam Beneschan
2011-03-28 19:52                   ` Robert A Duff
2011-03-29  2:32                     ` Randy Brukardt
2011-03-29  6:06                       ` Shark8
2011-03-29 23:45                         ` Randy Brukardt
2011-03-29 19:19                       ` Robert A Duff
2011-03-30  0:02                         ` Randy Brukardt
2011-03-30 12:40                           ` Robert A Duff
2011-03-30 19:40                             ` Randy Brukardt
2011-03-30 20:56                               ` tmoran
2011-03-30 22:34                                 ` Robert A Duff
2011-03-31 21:00                                   ` Randy Brukardt
2011-03-28 20:29                 ` Hyman Rosen
2011-03-28 21:16                   ` Adam Beneschan
2011-03-28 21:26                     ` Hyman Rosen
2011-03-28 22:08                       ` Adam Beneschan
2011-03-28 23:47                         ` Georg Bauhaus
2011-03-29 12:23                           ` stefan-lucks
2011-03-29 13:10                             ` Hyman Rosen
2011-03-30 13:42                             ` Phil Clayton
2011-03-31  7:40                               ` Phil Clayton
2011-03-29  2:48                         ` Hyman Rosen
2011-03-29 18:30                           ` Robert A Duff
2011-03-29 23:25                             ` Adam Beneschan
2011-03-30 12:50                               ` Robert A Duff
2011-03-30 14:47                                 ` Adam Beneschan
2011-03-30 18:10                                   ` Robert A Duff
2011-03-29  3:01                         ` Hyman Rosen
2011-03-29 18:22                           ` Robert A Duff
2011-03-26 21:30           ` Florian Weimer
2011-03-27 16:18             ` Robert A Duff
2011-03-27 16:38               ` Florian Weimer
2011-03-27 16:56                 ` Robert A Duff
2011-03-24  2:15   ` Shark8
2011-03-24  0:38 ` ytomino
2011-03-24  2:23   ` Shark8
2011-03-24 21:29 ` Gautier write-only
2011-03-25 12:47 ` Marco
2011-03-25 15:38   ` Yannick Duchêne (Hibou57)
2011-03-26  8:39     ` ObjectAda [was: Pascal Calling Convention] Gautier write-only
2011-03-26 14:05       ` Marco
2011-03-26 21:58         ` Gautier write-only
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox