diff --git a/BeefLibs/corlib/src/Runtime.bf b/BeefLibs/corlib/src/Runtime.bf index 29709220..520a6319 100644 --- a/BeefLibs/corlib/src/Runtime.bf +++ b/BeefLibs/corlib/src/Runtime.bf @@ -646,12 +646,14 @@ namespace System { static function void*(int) sMallocFunc; static function void(void*) sFreeFunc; + static function void(char8) sPutChar; static this() { var lib = Windows.LoadLibraryA("msvcrt.dll"); sMallocFunc = (.)Windows.GetProcAddress(lib, "malloc"); sFreeFunc = (.)Windows.GetProcAddress(lib, "free"); + sPutChar = (.)Windows.GetProcAddress(lib, "putchar"); } /*[LinkName(.C), AlwaysInclude] @@ -672,6 +674,12 @@ namespace System sFreeFunc(ptr); } + [LinkName(.C), AlwaysInclude] + static void putchar(char8 c) + { + sPutChar(c); + } + [LinkName(.C), AlwaysInclude] static void memset(void* dest, uint8 val, int size) { @@ -735,10 +743,15 @@ namespace System [LinkName(.C), AlwaysInclude] static void mainCRTStartup() { - //WinMain(null, null, "hi", 1); main(0, null); } + /*[LinkName(.C), AlwaysInclude] + static void WinMainCRTStartup() + { + //WinMain(null, null, "hi", 1); + }*/ + [LinkName(.C), Export] static int32 _tls_index; diff --git a/BeefLibs/corlib/src/Windows.bf b/BeefLibs/corlib/src/Windows.bf index 7991aa2a..a0fe1b44 100644 --- a/BeefLibs/corlib/src/Windows.bf +++ b/BeefLibs/corlib/src/Windows.bf @@ -1829,7 +1829,7 @@ namespace System [CLink, CallingConvention(.Stdcall)] public static extern HInstance LoadLibraryW(char16* libFileName); - [CLink, CallingConvention(.Stdcall)] + [Import("kernel32.lib"), CLink, CallingConvention(.Stdcall)] public static extern HInstance LoadLibraryA(char8* libFileName); [CLink, CallingConvention(.Stdcall)] diff --git a/IDE/Tests/Tiny/BeefSpace.toml b/IDE/Tests/Tiny/BeefSpace.toml index 9ec4296a..f453e87a 100644 --- a/IDE/Tests/Tiny/BeefSpace.toml +++ b/IDE/Tests/Tiny/BeefSpace.toml @@ -24,3 +24,17 @@ ReflectKind = "Minimal" [Configs.Release.Win64] RuntimeKind = "Reduced" ReflectKind = "Minimal" + +[Configs.Release.Win32] +RuntimeKind = "Reduced" +ReflectKind = "Minimal" + +[Configs.ReleaseNoRT.Win64] +RuntimeKind = "Disabled" +ReflectKind = "Minimal" +ConfigSelections = {Tiny = {Config = "Release"}} + +[Configs.ReleaseNoRT.Win32] +RuntimeKind = "Disabled" +ReflectKind = "Minimal" +ConfigSelections = {Tiny = {Config = "Release"}} diff --git a/bin/test_build.bat b/bin/test_build.bat index cf228ceb..e077986c 100644 --- a/bin/test_build.bat +++ b/bin/test_build.bat @@ -46,6 +46,20 @@ if %size% GTR 16000 ( goto :HADERROR ) +@ECHO Building Tiny NoRT +bin\RunWithStats IDE\dist\BeefBuild -proddir=IDE\Tests\Tiny -clean -config=ReleaseNoRT +set size=0 +FOR /F "usebackq" %%A IN ('IDE\Tests\Tiny\build\ReleaseNoRT_Win64\Tiny\Tiny.exe') DO set size=%%~zA +echo Tiny executable size: %size% (expected 5120, max 7000) +if %size% LSS 1000 ( + echo TINY executable not found? + goto :HADERROR +) +if %size% GTR 7000 ( + echo TINY executable is too large! + goto :HADERROR +) + @ECHO Building BeefIDE_d with BeefBuild_d bin\RunAndWait IDE\dist\BeefPerf.exe -cmd="Nop()" @IF %ERRORLEVEL% NEQ 0 GOTO FAILPERF_START