Skip to content

Commit 08d6e32

Browse files
committed
Added WinMain entry test
1 parent 13d9528 commit 08d6e32

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

tests/run.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,8 @@ call :compile while_continue
387387
if %errorlevel% neq 0 popd & exit /b %errorlevel%
388388
call :compile windowed
389389
if %errorlevel% neq 0 popd & exit /b %errorlevel%
390+
call :compile winmain_entry
391+
if %errorlevel% neq 0 popd & exit /b %errorlevel%
390392

391393
:: Delete debugging dump files if present
392394
if exist ast.txt del /F ast.txt

tests/run.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ compile while || exit $?
208208
compile while_continue || exit $?
209209
compile windowed || exit $?
210210

211+
#compile winmain || exit $?
212+
printf "Skipping \033[0;31mwinmain_entry\033[0m test program\n"
213+
211214
# Delete debugging dump files if present
212215
rm -f ast.txt
213216
rm -f infer.txt

tests/winmain_entry/main.adept

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
pragma windows_only
2+
3+
import 'sys/cstdio.adept'
4+
5+
alias HANDLE = ptr
6+
alias HINSTANCE = HANDLE
7+
alias LPSTR = *ubyte
8+
9+
record Bomb (message *ubyte) {
10+
func __defer__ {
11+
printf('%s\n', this.message)
12+
}
13+
}
14+
15+
bomb Bomb = Bomb('Hello World')
16+
17+
external stdcall func WinMain(hInstance, hPrevInstance HINSTANCE, lpCmdLine LPSTR, nCmdShow int) int {
18+
// The initialization of 'bomb' and its automatic '__defer__' call should
19+
// happen here implicitly
20+
}
21+
22+
/*
23+
If no main function exists, and an 'external stdcall func WinMain' exists,
24+
then it will be treated as the entry point
25+
*/

0 commit comments

Comments
 (0)