Skip to content

Commit

Permalink
Added WinMain entry test
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacShelton committed Dec 3, 2021
1 parent 13d9528 commit 08d6e32
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ call :compile while_continue
if %errorlevel% neq 0 popd & exit /b %errorlevel%
call :compile windowed
if %errorlevel% neq 0 popd & exit /b %errorlevel%
call :compile winmain_entry
if %errorlevel% neq 0 popd & exit /b %errorlevel%

:: Delete debugging dump files if present
if exist ast.txt del /F ast.txt
Expand Down
3 changes: 3 additions & 0 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ compile while || exit $?
compile while_continue || exit $?
compile windowed || exit $?

#compile winmain || exit $?
printf "Skipping \033[0;31mwinmain_entry\033[0m test program\n"

# Delete debugging dump files if present
rm -f ast.txt
rm -f infer.txt
Expand Down
25 changes: 25 additions & 0 deletions tests/winmain_entry/main.adept
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pragma windows_only

import 'sys/cstdio.adept'

alias HANDLE = ptr
alias HINSTANCE = HANDLE
alias LPSTR = *ubyte

record Bomb (message *ubyte) {
func __defer__ {
printf('%s\n', this.message)
}
}

bomb Bomb = Bomb('Hello World')

external stdcall func WinMain(hInstance, hPrevInstance HINSTANCE, lpCmdLine LPSTR, nCmdShow int) int {
// The initialization of 'bomb' and its automatic '__defer__' call should
// happen here implicitly
}

/*
If no main function exists, and an 'external stdcall func WinMain' exists,
then it will be treated as the entry point
*/

0 comments on commit 08d6e32

Please sign in to comment.