Page 1 of 1

c compiler question

Posted: Tue Apr 15, 2003 11:00 pm
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

RE:c compiler question

Posted: Tue Apr 15, 2003 11:00 pm
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

RE:c compiler question

Posted: Tue Apr 15, 2003 11:00 pm
by VoidLogic
Borland C++ 4.0 on up also does, as well as VC++ and free Watcom

RE:c compiler question

Posted: Wed Apr 16, 2003 11:00 pm
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

RE:c compiler question

Posted: Wed Apr 16, 2003 11:00 pm
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?

RE:c compiler question

Posted: Wed Apr 16, 2003 11:00 pm
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

RE:c compiler question

Posted: Wed Apr 16, 2003 11:00 pm
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

RE:c compiler question

Posted: Thu Apr 17, 2003 11:00 pm
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."

RE:c compiler question

Posted: Thu Apr 17, 2003 11:00 pm
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 :).

RE:c compiler question

Posted: Thu Apr 17, 2003 11:00 pm
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.

RE:c compiler question

Posted: Fri Apr 18, 2003 11:00 pm
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.

RE:c compiler question

Posted: Fri Apr 18, 2003 11:00 pm
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."

RE:c compiler question

Posted: Sun Apr 20, 2003 11:00 pm
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