tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Problem using GetLargestConsoleWindowSize


From: Pierre
Subject: Re: [Tinycc-devel] Problem using GetLargestConsoleWindowSize
Date: Sun, 15 Dec 2013 08:49:54 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

It seem to have a problem with functions that return structs instead of base types. (struct pushed on stack)
There is a problem too with div() than returns a div_t struct.
 (I have made a post a week ago for this problem)

The problem is probably a bad read of return result on the stack.
I will try to understand how cc works to try to fix it
Pierre





Le 15/12/2013 03:23, Carlos Montiers a écrit :
Hello. Using the last version of tiny c I try use the function GetLargestConsoleWindowSize, but I get ERROR_INVALID_HANDLE

the program print:
C:\tcc>test.exe
Error:6
coords.X:-4340 coords.Y:30654

the same code using gcc:
C:\tcc>gcc test.c -o test.exe

C:\tcc>test.exe
coords.X:170 coords.Y:59

that is right.

Please, someone can helpme with the solution. I want use for this code tiny c and not gcc.


This is the code:

#include <windows.h>
#include <stdio.h>

int main()
{
    HANDLE hOut;
    COORD coords;
    hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    if (INVALID_HANDLE_VALUE == hOut) {
        printf("STD_OUTPUT_HANDLE is INVALID_HANDLE_VALUE\n");
    }
   
    coords = GetLargestConsoleWindowSize(hOut);
   
    if (coords.X <= 0 || coords.Y <= 0) {
        printf("Error:%d\n", GetLastError());
    }

    printf("coords.X:%d coords.Y:%d\n", coords.X, coords.Y);
   
    getchar();
   
    return 0;
   
}



_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


reply via email to

[Prev in Thread] Current Thread [Next in Thread]