Web lists-archives.com

Re: Why is __unix__ defined, and not __WINDOWS__ ?

On 13/05/2019 07.39, Brian Inglis wrote:
Not quite I believe Cygwin 64 bit programs follow the Unix 64 bit LP64 C
programming memory model and the System V AMD64 ABI *NOT* the Windows 64 bit
ILP64 C programming memory model and Microsoft x64 calling convention; see:
- the interface has to be managed by the Cygwin1 dll.

I tried this:

int test (int x) {
    return x + 1;
g++ -S -O2 t.cpp

Assembly output from g++ or clang:

        leal    1(%rcx), %eax

The Win64 ABI has the paramter in ecx or rcx, the SysV ABI has it in edi.

A dump of the object file shows it is in COFF64 format.

The object file obeys the Win64 ABI and links directly into a Win64 project. The cygwin dll is not needed if the rest of the executable is made with another compiler.

The executable runs under Windows, not under Linux.

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple