c compiler question

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
mindvnas

c compiler question

Post by mindvnas »

hi everyone,
is there a C compiler that uses Pascal calling conventions?
ie. pushes parameters from left to right and doesnt use variable number of parameters? or is there such a patch for gcc?
thanks in advance

mindvnas
carbonBased

RE:c compiler question

Post by carbonBased »

I believe Borland's [Turbo] C/C++ had a keyword for functions that would tell the compiler to use the pascal calling convention.

As for GCC, I don't know.

Oh... and the compiler from MMURTL (?) used the pascal calling convention (pretty sure, anyway...)

Jeff
VoidLogic

RE:c compiler question

Post by VoidLogic »

Borland C++ 4.0 on up also does, as well as VC++ and free Watcom
mindvnas

RE:c compiler question

Post by mindvnas »

VC++ means ms visual c++ or something else i dont know about?
borland c++ 4.0: is there such a compiler? i though they'd abandoned it at 3.0

anyway, thanks for the answers.
mindvnas
Tim Robinson

RE:c compiler question

Post by Tim Robinson »

VC++ doesn't. I'd be surprised if any 32-bit Windows compiler supported this, as the Pascal calling convention is no longer used by the Windows API.

Why do you need to use the Pascal convention?
VoidLogic

RE:c compiler question

Post by VoidLogic »

Hey,
Actully Visual C++ does support Pascal calling coventions (Watcom and Borland too). Before you miss-inform people you should type some code and see for your self. Also Borland made C/C++/inline ASM compilers up to version 5.02. I have it.  They, unlike MS continued to support both 32-bit and 16-bit developement. Watcom, however, supports DOS real mode, 16-bit PMODE DOS, 32-PMODE DOS (with many different extenders to choose from), Win386 (for Windows 386 i assume), Win16, Win32 (console and GUI), and Netware.

-VoidLogic
carbonBased

RE:c compiler question

Post by carbonBased »

Borland for sure does... they'd be stupid not to... seeing as though they own a HUGE chunk of the pascal development market (with Delphi and Kylix).

As for why... dunno... it's easier to code, at least :)

Cheers,
Jeff
Tim Robinson

RE:c compiler question

Post by Tim Robinson »

Version 1.52 was the last version of VC++ to support the Pascal calling convention.

From MSDN (__pascal keyword):

"The __pascal, __fortran, and __syscall calling conventions are no longer supported. You can emulate their functionality by using one of the supported calling conventions and appropriate linker options."
VoidLogic

RE:c compiler question

Post by VoidLogic »

your right as the LASTEST version does not support it. But it was critacal for many people devopleding Win 16s. Anyway, I hope no one is try to use VC++ 6.0 for OS dev :).
mindvnas

RE:c compiler question

Post by mindvnas »

> VC++ doesn't. I'd be surprised if any 32-bit Windows compiler supported
> this, as the Pascal calling convention is no longer used by the Windows API.
yup, you may be right:
i have checked openWatcom 1.0 (since i couldnt find Watcom 10/11), and though it states it supports Pascal calling convention, it does not, actually. same results for borland c++ builder 5.5 -> have a "-p" option, but it doesnt do anything...

> Why do you need to use the Pascal convention?
because i am more familiar with it, and my OS uses it too.
anyway, i just started C a few weeks ago, and i want to finish my OS in C (hope its faster that developing in pure assembly), but if i cant find such a compiler, i am stuck.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

RE:c compiler question

Post by df »

are you sure open watcom does not support it? i dont have it on this machine anymore (nor 10.6/11 now either).

i know 10.6 supported pascal calling convention at definitions. as I remmber linking to some pascal libs when I did some demo coding.

i still dont understand why you _need_ pascal calling convention in a C compiler. just change the order of passing in to your asm routines.. cant be that hard.
-- Stu --
VoidLogic

RE:c compiler question

Post by VoidLogic »

Open Watcom does support it:

"__pascal

Open Watcom C/C++ supports the __pascal keyword to describe Pascal functions that are called using a special convention described by a pragma in the "stddef.h" header file.

Open Watcom C/C++ predefines the macros pascal,  _pascal and _Pascal to be equivalent to the __pascal keyword."
mindvnas

RE:c compiler question

Post by mindvnas »

thanks. i didnt find that one... i looked at the command line switches and there was no such option.
i need it because in Pascal, the called routine clears up the stack, meanwhile in C the calling code does that (for support of variable length parameters lists)
thanks again
Post Reply