-
-
Save emekoi/7b2b502f3536ebc36e1282f9a8e9c545 to your computer and use it in GitHub Desktop.
zig winmain error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// runs WinMain using this WinMainCRTStartup | |
const HANDLE = *c_void; | |
const LPCTSTR = [*c]const u8; | |
const UINT = c_uint; | |
const HINSTANCE = ?*@OpaqueType(); | |
const HMODULE = ?*@OpaqueType(); | |
const PWSTR = [*c]u16; | |
const INT = c_int; | |
extern "kernel32" stdcallcc fn GetModuleHandleA(lpModuleName: ?[*]const u8) HINSTANCE; | |
extern "user32" stdcallcc fn MessageBoxA(hWnd: ?HANDLE, lpText: ?LPCTSTR, lpCaption: ?LPCTSTR, uType: UINT) c_int; | |
pub extern "kernel32" stdcallcc fn ExitProcess(exit_code: UINT) noreturn; | |
export stdcallcc fn WinMain(hInstance: HINSTANCE, hPrevInstance: HINSTANCE, lpCmdLine: PWSTR, nCmdShow: INT) UINT { | |
_ = MessageBoxA(null, c"hello", c"title", 0); | |
return 0; | |
} | |
export fn WinMainCRTStartup() noreturn { | |
@setAlignStack(16); | |
const result = WinMain(GetModuleHandleA(null), null, null, 0); | |
ExitProcess(result); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// error: exported symbol collision: 'WinMainCRTStartup' | |
// error: root source file has no member called 'main' | |
const HANDLE = *c_void; | |
const LPCTSTR = [*c]const u8; | |
const UINT = c_uint; | |
const HINSTANCE = ?*@OpaqueType(); | |
const HMODULE = ?*@OpaqueType(); | |
const PWSTR = [*c]u16; | |
const INT = c_int; | |
extern "kernel32" stdcallcc fn GetModuleHandleA(lpModuleName: ?[*]const u8) HINSTANCE; | |
extern "user32" stdcallcc fn MessageBoxA(hWnd: ?HANDLE, lpText: ?LPCTSTR, lpCaption: ?LPCTSTR, uType: UINT) c_int; | |
pub extern "kernel32" stdcallcc fn ExitProcess(exit_code: UINT) noreturn; | |
export stdcallcc fn WinMain(hInstance: HINSTANCE, hPrevInstance: HINSTANCE, lpCmdLine: PWSTR, nCmdShow: INT) UINT { | |
_ = MessageBoxA(null, c"hello", c"title", 0); | |
return 0; | |
} | |
export stdcallcc fn WinMainCRTStartup() noreturn { | |
@setAlignStack(16); | |
const result = WinMain(GetModuleHandleA(null), null, null, 0); | |
ExitProcess(result); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// runs WinMain using bootstrap.WinMainCRTStartup | |
const HANDLE = *c_void; | |
const LPCTSTR = [*]const u8; | |
const UINT = c_uint; | |
const HINSTANCE = *@OpaqueType(); | |
const HMODULE = *@OpaqueType(); | |
const PWSTR = [*]u16; | |
const INT = c_int; | |
extern "kernel32" stdcallcc fn GetModuleHandleA(lpModuleName: ?[*]const u8) HINSTANCE; | |
extern "user32" stdcallcc fn MessageBoxA(hWnd: ?HANDLE, lpText: ?LPCTSTR, lpCaption: ?LPCTSTR, uType: UINT) c_int; | |
extern "kernel32" stdcallcc fn ExitProcess(exit_code: UINT) noreturn; | |
export fn WinMain(hInstance: ?HINSTANCE, hPrevInstance: ?HINSTANCE, lpCmdLine: ?PWSTR, nCmdShow: INT) UINT { | |
_ = MessageBoxA(null, c"hello", c"title", 0); | |
return 0; | |
} | |
export fn WinMainCRTStartup() noreturn { | |
@setAlignStack(16); | |
const result = WinMain(GetModuleHandleA(null), null, null, 0); | |
ExitProcess(result); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// runs WinMain using bootstrap.WinMainCRTStartup | |
const HANDLE = *c_void; | |
const LPCTSTR = [*]const u8; | |
const UINT = c_uint; | |
const HINSTANCE = *@OpaqueType(); | |
const HMODULE = *@OpaqueType(); | |
const PWSTR = [*]u16; | |
const INT = c_int; | |
extern "kernel32" stdcallcc fn GetModuleHandleA(lpModuleName: ?[*]const u8) HINSTANCE; | |
extern "user32" stdcallcc fn MessageBoxA(hWnd: ?HANDLE, lpText: ?LPCTSTR, lpCaption: ?LPCTSTR, uType: UINT) c_int; | |
extern "kernel32" stdcallcc fn ExitProcess(exit_code: UINT) noreturn; | |
export fn WinMain(hInstance: ?HINSTANCE, hPrevInstance: ?HINSTANCE, lpCmdLine: ?PWSTR, nCmdShow: INT) UINT { | |
_ = MessageBoxA(null, c"hello", c"title", 0); | |
return 0; | |
} | |
export stdcallcc fn WinMainCRTStartup() noreturn { | |
@setAlignStack(16); | |
const result = WinMain(GetModuleHandleA(null), null, null, 0); | |
ExitProcess(result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment