mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-09 03:54:22 +00:00
stdcall -> system
This commit is contained in:
@@ -53,7 +53,7 @@ PAGE_TARGETS_NO_UPDATE :: 0x40000000
|
||||
ERROR_INVALID_ADDRESS :: 487
|
||||
ERROR_COMMITMENT_LIMIT :: 1455
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
@(default_calling_convention="system")
|
||||
foreign Kernel32 {
|
||||
GetSystemInfo :: proc(lpSystemInfo: LPSYSTEM_INFO) ---
|
||||
VirtualAlloc :: proc(lpAddress: rawptr, dwSize: uint, flAllocationType: u32, flProtect: u32) -> rawptr ---
|
||||
|
||||
@@ -7,7 +7,7 @@ import "core:intrinsics"
|
||||
|
||||
when ODIN_BUILD_MODE == .Dynamic {
|
||||
@(link_name="DllMain", linkage="strong", require)
|
||||
DllMain :: proc "stdcall" (hinstDLL: rawptr, fdwReason: u32, lpReserved: rawptr) -> b32 {
|
||||
DllMain :: proc "system" (hinstDLL: rawptr, fdwReason: u32, lpReserved: rawptr) -> b32 {
|
||||
context = default_context()
|
||||
|
||||
// Populate Windows DLL-specific global
|
||||
@@ -29,7 +29,7 @@ when ODIN_BUILD_MODE == .Dynamic {
|
||||
} else when !ODIN_TEST && !ODIN_NO_ENTRY_POINT {
|
||||
when ODIN_ARCH == .i386 || ODIN_NO_CRT {
|
||||
@(link_name="mainCRTStartup", linkage="strong", require)
|
||||
mainCRTStartup :: proc "stdcall" () -> i32 {
|
||||
mainCRTStartup :: proc "system" () -> i32 {
|
||||
context = default_context()
|
||||
#force_no_inline _startup_runtime()
|
||||
intrinsics.__entry_point()
|
||||
|
||||
@@ -4,7 +4,7 @@ package runtime
|
||||
foreign import kernel32 "system:Kernel32.lib"
|
||||
|
||||
@(private="file")
|
||||
@(default_calling_convention="stdcall")
|
||||
@(default_calling_convention="system")
|
||||
foreign kernel32 {
|
||||
// NOTE(bill): The types are not using the standard names (e.g. DWORD and LPVOID) to just minimizing the dependency
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ when ODIN_NO_CRT && ODIN_OS == .Windows {
|
||||
foreign import lib "system:NtDll.lib"
|
||||
|
||||
@(private="file")
|
||||
@(default_calling_convention="stdcall")
|
||||
@(default_calling_convention="system")
|
||||
foreign lib {
|
||||
RtlMoveMemory :: proc(dst, s: rawptr, length: int) ---
|
||||
RtlFillMemory :: proc(dst: rawptr, length: int, fill: i32) ---
|
||||
|
||||
@@ -6,7 +6,7 @@ foreign import kernel32 "system:Kernel32.lib"
|
||||
|
||||
@(private)
|
||||
foreign kernel32 {
|
||||
RaiseException :: proc "stdcall" (dwExceptionCode, dwExceptionFlags, nNumberOfArguments: u32, lpArguments: ^uint) -> ! ---
|
||||
RaiseException :: proc "system" (dwExceptionCode, dwExceptionFlags, nNumberOfArguments: u32, lpArguments: ^uint) -> ! ---
|
||||
}
|
||||
|
||||
windows_trap_array_bounds :: proc "contextless" () -> ! {
|
||||
|
||||
@@ -13,7 +13,7 @@ windows_trap_array_bounds :: proc "contextless" () -> ! {
|
||||
EXCEPTION_ARRAY_BOUNDS_EXCEEDED :: 0xC000008C
|
||||
|
||||
foreign kernel32 {
|
||||
RaiseException :: proc "stdcall" (dwExceptionCode, dwExceptionFlags, nNumberOfArguments: DWORD, lpArguments: ^ULONG_PTR) -> ! ---
|
||||
RaiseException :: proc "system" (dwExceptionCode, dwExceptionFlags, nNumberOfArguments: DWORD, lpArguments: ^ULONG_PTR) -> ! ---
|
||||
}
|
||||
|
||||
RaiseException(EXCEPTION_ARRAY_BOUNDS_EXCEEDED, 0, 0, nil)
|
||||
|
||||
@@ -5,14 +5,14 @@ package sync
|
||||
import "core:time"
|
||||
|
||||
foreign import Synchronization "system:Synchronization.lib"
|
||||
@(default_calling_convention="stdcall")
|
||||
@(default_calling_convention="system")
|
||||
foreign Synchronization {
|
||||
WakeByAddressSingle :: proc(Address: rawptr) ---
|
||||
WakeByAddressAll :: proc(Address: rawptr) ---
|
||||
}
|
||||
|
||||
foreign import Ntdll "system:Ntdll.lib"
|
||||
@(default_calling_convention="stdcall")
|
||||
@(default_calling_convention="system")
|
||||
foreign Ntdll {
|
||||
RtlWaitOnAddress :: proc(Address: rawptr, CompareAddress: rawptr, AddressSize: uint, Timeout: ^i64) -> i32 ---
|
||||
RtlNtStatusToDosError :: proc(status: i32) -> u32 ---
|
||||
@@ -30,7 +30,7 @@ foreign Ntdll {
|
||||
|
||||
GODDAMN MICROSOFT!
|
||||
*/
|
||||
CustomWaitOnAddress :: proc "stdcall" (Address: rawptr, CompareAddress: rawptr, AddressSize: uint, Timeout: ^i64) -> bool {
|
||||
CustomWaitOnAddress :: proc "system" (Address: rawptr, CompareAddress: rawptr, AddressSize: uint, Timeout: ^i64) -> bool {
|
||||
status := RtlWaitOnAddress(Address, CompareAddress, AddressSize, Timeout)
|
||||
if status != 0 {
|
||||
SetLastError(RtlNtStatusToDosError(status))
|
||||
|
||||
@@ -3,7 +3,7 @@ package sys_windows
|
||||
|
||||
foreign import "system:Dnsapi.lib"
|
||||
|
||||
@(default_calling_convention="std")
|
||||
@(default_calling_convention="system")
|
||||
foreign Dnsapi {
|
||||
DnsQuery_UTF8 :: proc(name: cstring, type: u16, options: DWORD, extra: PVOID, results: ^^DNS_RECORD, reserved: PVOID) -> DNS_STATUS ---
|
||||
DnsRecordListFree :: proc(list: ^DNS_RECORD, options: DWORD) ---
|
||||
|
||||
@@ -217,7 +217,7 @@ NL_DAD_STATE :: enum i32 {
|
||||
IpDadStatePreferred = 4,
|
||||
}
|
||||
|
||||
@(default_calling_convention = "std")
|
||||
@(default_calling_convention = "system")
|
||||
foreign iphlpapi {
|
||||
/*
|
||||
The GetAdaptersAddresses function retrieves the addresses associated with the adapters on the local computer.
|
||||
|
||||
@@ -90,7 +90,7 @@ Thread_Os_Specific :: struct {
|
||||
}
|
||||
|
||||
thread_create :: proc(procedure: Thread_Proc) -> ^Thread {
|
||||
__windows_thread_entry_proc :: proc "stdcall" (t_: rawptr) -> win32.DWORD {
|
||||
__windows_thread_entry_proc :: proc "system" (t_: rawptr) -> win32.DWORD {
|
||||
t := (^Thread)(t_)
|
||||
context = t.init_context.? or_else runtime.default_context()
|
||||
|
||||
@@ -172,7 +172,7 @@ global_current_t: ^T
|
||||
|
||||
run_internal_test :: proc(t: ^T, it: Internal_Test) {
|
||||
thread := thread_create(proc(thread: ^Thread) {
|
||||
exception_handler_proc :: proc "stdcall" (ExceptionInfo: ^win32.EXCEPTION_POINTERS) -> win32.LONG {
|
||||
exception_handler_proc :: proc "system" (ExceptionInfo: ^win32.EXCEPTION_POINTERS) -> win32.LONG {
|
||||
switch ExceptionInfo.ExceptionRecord.ExceptionCode {
|
||||
case
|
||||
win32.EXCEPTION_DATATYPE_MISALIGNMENT,
|
||||
|
||||
@@ -21,7 +21,7 @@ _thread_priority_map := [Thread_Priority]i32{
|
||||
_create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
|
||||
win32_thread_id: win32.DWORD
|
||||
|
||||
__windows_thread_entry_proc :: proc "stdcall" (t_: rawptr) -> win32.DWORD {
|
||||
__windows_thread_entry_proc :: proc "system" (t_: rawptr) -> win32.DWORD {
|
||||
t := (^Thread)(t_)
|
||||
|
||||
t.id = sync.current_thread_id()
|
||||
|
||||
Reference in New Issue
Block a user