From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,2cb1f0b6d642e1dc X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news3.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!195.96.0.7.MISMATCH!newsfeed.utanet.at!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Pascal Calling Convention Date: Thu, 24 Mar 2011 00:25:50 +0100 Organization: Ada @ Home Message-ID: References: <9b04626e-567d-408c-aab3-39b964b3ffd6@l2g2000prg.googlegroups.com> NNTP-Posting-Host: 2QUn1ohZpH4hOnePpX4N1w.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/11.01 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: g2news2.google.com comp.lang.ada:19379 Date: 2011-03-24T00:25:50+01:00 List-Id: Hello Shark, Le Wed, 23 Mar 2011 22:37:55 +0100, Shark8 a = = =C3=A9crit: > I was looking around for a way to use the Pascal calling convention in= > GNAT; particularly because I thought it might be nice to do the GUI- > stuff in good old Delphi 5 and the application itself in Ada. All > easily doable via DLL or, possibly, through the $L compiler directive > which specifies a .obj file to link to. > > -- I found a utility to convert between .o and .obj; so that's not a > problem. Though if someone knows a way to > -- have GNAT emit .obj files instead of .o I'd like to hear it. You should not ask for GNAT to do it, rather to GNU ld which GNAT relies= = on (it does not have an internal linker). GNU ld does not support MS = Windows object file format, as far as I know (the only Windows specific = = format it supports, it the one for compiled resource files data). > 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=3D1233 ) there i= s > 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 pus= h = 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). 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=E2=80=99es= t pas pour = les chiens. =E2=80=9C c++; /* this makes c bigger but returns the old value */ =E2=80= =9D [Anonymous]