Debug mode / Functions C do not work
darioradu opened this issue · comments
I'm trying to run a basic program that prints a hello world message to the console using the puts function.The program works fine while executing it with "Build and run" option, I mean the message is displayed in the Output.

But if i use the "Debug" option, the program runs but the message is not displayed in the output

I'm working on Windows 10 64 bits
SASM version 3.12.2
See the Build tab options configured:

It's because output is buffered. You need to call fflush(stdin) to get output immediately like this:
%include "io64.inc"
global main
extern puts
extern fflush
extern get_stdout
section .data
message db "Hello World", 0
section .text
main:
mov rbp, rsp
sub rsp, 32
mov rcx, message
call puts
call get_stdout
mov rcx, rax
call fflush
add rsp, 32
ret