Test program source:
int main(){
MessageBoxA(0,"show msgbox ok, but exit has issue","0 LPCSTR lpCaption",0);
printf("[2]\n");
printf("[3]\n");
printf("[4]\n");
return 0;
}
And then compile it tcc\tcc msgbox.c tcc\lib\user32.def
msgbox.exe
echo %errorlevel%
-1073741795
If I remove MessageBoxA API call, echo %errorlevel% is 0
tcc\tcc -v
tcc version 0.9.26 (i386 Win32)
--EDIT--
tcc-0.9.27-win64 work properly
tcc64\tcc -v
tcc version 0.9.27 (x86_64 Windows)
>tcc64\tcc msgboxPid.c tcc64\lib\kernel32.def tcc64\lib\user32.def
msgboxPid.c:9: warning: implicit declaration of function 'MessageBoxA'
msgboxPid.c:10: warning: implicit declaration of function 'printf'
>msgbox.exe
[2]
[3]
[4]
>echo %errorlevel%
0