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
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to