News:

Download Pelles C here: http://www.pellesc.se

Main Menu

Recent posts

#11
Graphics programming / Re: raylib 5.5 + PellesC v13.0...
Last post by Vortex - March 10, 2026, 10:00:16 PM
Hi rweidner,

ChatGPT's example code using raygui :

#include "raylib.h"

#define RAYGUI_IMPLEMENTATION
#include "raygui.h"

int main(void)
{
    InitWindow(640, 200, "raygui textbox");

    char text[128] = "Edit me";
    bool editMode = false;

    SetTargetFPS(60);

    while (!WindowShouldClose())
    {
        Rectangle rect = {100, 80, 200, 30};

        BeginDrawing();
        ClearBackground(RAYWHITE);

        if (GuiTextBox(rect, text, 128, editMode))
            editMode = !editMode;

        EndDrawing();
    }

    CloseWindow();
}

https://github.com/raysan5/raygui
#12
Bug reports / Re: bug report. setvbuf() func...
Last post by John Z - March 10, 2026, 09:20:06 PM
The issue seems limited to the predefined streams.
 Checked using stderr  and the same issue exists.

Checked using a 'true' File *p_file stream and could not get it to fail.  I also use setvbuf  extensively in many places in other programs without issue so this makes sense.

To see if it is a 'speed' issue putting a delay loop between printf / fprintf steps might check that.  For the most part the dropouts appear mostly in the same location, with minor variations which might be due to other activity on the system.

To be continued -

John Z

Update:  Delay loop makes no difference. 
for (loup = 0; loup < 8000000; loup++) // 8K to 8000k tested
           {a = -a;}

Dropout (for want of a better word) is very consistent test after test happens in about the same location.
#13
Assembly discussions / Re: raylib sample
Last post by Vortex - March 10, 2026, 08:41:03 PM
Here is the 64-bit version :

include    raylibDemo.inc

.data

msg1        db 'raylib hello',0
msg2        db 'Hello, raylib!',0

.code

start:

    sub    rsp,8+4*8
    call    main
    invoke  ExitProcess,0

main PROC PARMAREA=5*SIZEOF QWORD

    invoke  InitWindow,800,450,ADDR msg1
    invoke  SetTargetFPS,60
@@:
    invoke  WindowShouldClose
    test    rax,rax
    jnz    @f

    invoke  BeginDrawing
    invoke  ClearBackground,RAYWHITE
    invoke  DrawText,ADDR msg2,190,200,40,BLACK
    invoke  EndDrawing
    jmp    @b
@@:
    invoke  CloseWindow
    ret

main ENDP

END start
#14
Assembly discussions / raylib sample
Last post by Vortex - March 10, 2026, 08:11:29 PM
Hello,

Inspired by the thread :

https://forum.pellesc.de/index.php?topic=11730.0

Extra files required to build and run the executable :

raylibdll.lib
raylib.dll

include     raylibDemo.inc

.data

msg1        db 'raylib hello',0
msg2        db 'Hello, raylib!',0

.code

start:

    invoke  InitWindow,800,450,ADDR msg1
    invoke  SetTargetFPS,60
@@:
    invoke  WindowShouldClose
    test    eax,eax
    jnz     @f

    invoke  BeginDrawing
    invoke  ClearBackground,RAYWHITE
    invoke  DrawText,ADDR msg2,190,200,40,BLACK
    invoke  EndDrawing
    jmp     @b
@@:
    invoke  CloseWindow

    invoke  ExitProcess,0

END start
#15
Bug reports / Re: bug report. setvbuf() func...
Last post by TimoVJL - March 10, 2026, 12:24:39 PM
#include <stdio.h>

int main(void)
{
    int size = 0;
    if (setvbuf(stdout, NULL, _IOFBF, 5000))
        fprintf(stdout, "setvbuf error\n");
    else {
        for (int i = 0; i <= 309; i++)
            size += fprintf(stdout, "'%d'\n", i);
        fprintf(stdout, "size: %d\n", size);
    }
    return 0;
}
'307'
'08'
'309'
size: 1750
#16
Bug reports / Re: bug report. setvbuf() func...
Last post by John Z - March 10, 2026, 02:57:04 AM
Great point!  Checking the return shows my 'fix' only works because setvbuf fails return is -1! so no buffer at all.

When 'fix' is removed setvbuf passes return is 0 but then errors on 7003.  In fact multiple errors in the return stream:
 
267? 0
268? 0
269?
270? 0
271? 0
-------
523? 0
524? 0
525?
526? 0
527? 0
-------
779? 0
780? 0
781?
782? 0
783? 0
-------
1011? 0
1012? 0
1013? 3? 0
1014? 0
1015? 0
-------
1239? 0
1240? 0
141? 0
1242? 0
1243? 0

Yikes something going on . . . . almost every 256th but some at 228

John Z
#17
Bug reports / Re: bug report. setvbuf() func...
Last post by TimoVJL - March 10, 2026, 01:10:28 AM
how about check function setvbuf() error too ?
#18
Bug reports / Re: bug report. setvbuf() func...
Last post by John Z - March 09, 2026, 09:59:50 PM
Test this - works for all buffer size setting I tried -

#include <stdio.h>

int main(void)
{   // all problems go away when next line is added
    printf("test result");// initializes stdout I/O ?
   
    setvbuf(stdout, NULL, _IOFBF, 7003);
    for (int i = 0; i <= 1351; i++)
        printf("%d?\n", i);
   
    return 0;
}

Maybe because of this statement in the help file?
"The setvbuf function may be used only after the stream pointed to by stream has been associated with an open file and before any other operation (other than an unsuccessful call to setvbuf) is performed on the stream. "

I am thinking that printf is initializing the stdout stream before setvbuf is called on stdout so no problem.

John Z
#19
Bug reports / Re: bug report. setvbuf() func...
Last post by TimoVJL - March 09, 2026, 05:31:09 PM
simpler check
#include <stdio.h>

int main(void)
{
    setvbuf(stdout, NULL, _IOFBF, 7000);
    for (int i = 0; i <= 1351; i++)
        printf("%d?\n", i);
   
    return 0;
}
output:
...
1328?
329?
1330?
1331?
1332?
1333?
1334?
1335?
1336?
1337?
1338?
1339?
1340?
1341?
1342?
1343?
1344?
1345?
1346?
1347?
1348?
1349?
1350?
13511351?

'1157'
'1151158'
'1159'
size: 7003
#20
Bug reports / Re: bug report. setvbuf() func...
Last post by ander_cc - March 09, 2026, 02:26:45 PM
Quote from: TimoVJL on March 09, 2026, 11:54:49 AMhttps://en.cppreference.com/w/c/io/setvbuf
buffer size should be at least multiple of 2

I have read it last week. "the actual buffer size is usually rounded down to a multiple of 2". Just NOT use some bytes, so any number is OK.

I try it at home, my laptop. see picture.
You cannot view this attachment.