Welcome, Guest. Please login or register.

Author Topic: Which includes to use for C compilers  (Read 13685 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline krashan

  • Sr. Member
  • ****
  • Join Date: Jan 2003
  • Posts: 254
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show all replies
    • Personal homepage
Re: Which includes to use for C compilers
« on: June 21, 2024, 06:58:51 AM »
Not sure about SAS/C, but VBCC does not come with includes replacing the NDK. Same for GCC. Usually compiler provides headers for C standard library and interface to AmigaOS API (it may be set of files in 'inline' or 'pragma' directory, someties with a static library). Definitions of AmigaOS structures come from the NDK. The NDK itself contains inline files too, which try to be universal. I prefer to replace NDK inlines with compiler provided ones, then place NDK includes in the include search path of the compiler.

Offline krashan

  • Sr. Member
  • ****
  • Join Date: Jan 2003
  • Posts: 254
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show all replies
    • Personal homepage
Re: Which includes to use for C compilers
« Reply #1 on: June 25, 2024, 03:42:23 PM »
Quote
what do you mean with 'replace' here, how do you replace them?
I replace them literally. Delete original ones and copy my files there.
Inline files in the NDK 3.2 are quite good and work with most of C compilers. However they are incompatible with GCC 2.95.3 compiler used in C++ mode. This was my reason to replace them.

Offline krashan

  • Sr. Member
  • ****
  • Join Date: Jan 2003
  • Posts: 254
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show all replies
    • Personal homepage
Re: Which includes to use for C compilers
« Reply #2 on: October 31, 2025, 06:37:59 PM »
GCC 2.95.3 does not support placing function arguments in specified CPU registers when in C++ mode. One has to resort to placing local variables in specified registers. For example

Code: [Select]
LONG foo(LONG argument __asm("d0"))
works in C mode, but not in C++ mode. However

Code: [Select]
LONG foo(LONG argument)
{
  register LONG _argument __asm("d0") = argument;

works in both modes.