aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHarold Brenes <harold@hbrenes.com>2025-09-29 19:54:53 -0400
committerHarold Brenes <harold@hbrenes.com>2025-09-29 19:58:14 -0400
commit24daa4427c75ea0f2ea0c7706b20849ac297c6fc (patch)
treea596a734aa1398e7f1c9f21c8f345dc4055cdb29 /core
parent9b4c0ea4920ea70b3e9206979aa7fd36608c4837 (diff)
Fix various foreign signatures
Diffstat (limited to 'core')
-rw-r--r--core/c/libc/stdio.odin2
-rw-r--r--core/sys/darwin/CoreFoundation/CFString.odin6
-rw-r--r--core/sys/posix/arpa_inet.odin1
-rw-r--r--core/sys/posix/pthread.odin4
-rw-r--r--core/sys/posix/sys_mman.odin7
5 files changed, 13 insertions, 7 deletions
diff --git a/core/c/libc/stdio.odin b/core/c/libc/stdio.odin
index 854a98637..aa92e4a6b 100644
--- a/core/c/libc/stdio.odin
+++ b/core/c/libc/stdio.odin
@@ -275,7 +275,7 @@ foreign libc {
// 7.21.7 Character input/output functions
fgetc :: proc(stream: ^FILE) -> int ---
fgets :: proc(s: [^]char, n: int, stream: ^FILE) -> [^]char ---
- fputc :: proc(s: cstring, stream: ^FILE) -> int ---
+ fputc :: proc(s: c.int, stream: ^FILE) -> int ---
getc :: proc(stream: ^FILE) -> int ---
getchar :: proc() -> int ---
putc :: proc(c: int, stream: ^FILE) -> int ---
diff --git a/core/sys/darwin/CoreFoundation/CFString.odin b/core/sys/darwin/CoreFoundation/CFString.odin
index 24485a494..d245ba793 100644
--- a/core/sys/darwin/CoreFoundation/CFString.odin
+++ b/core/sys/darwin/CoreFoundation/CFString.odin
@@ -1,10 +1,12 @@
package CoreFoundation
+import "core:c"
+
foreign import CoreFoundation "system:CoreFoundation.framework"
String :: distinct TypeRef // same as CFStringRef
-StringEncoding :: distinct u32
+StringEncoding :: distinct c.long
StringBuiltInEncodings :: enum StringEncoding {
MacRoman = 0,
@@ -171,7 +173,7 @@ foreign CoreFoundation {
// Fetches a range of the characters from a string into a byte buffer after converting the characters to a specified encoding.
StringGetBytes :: proc(thestring: String, range: Range, encoding: StringEncoding, lossByte: u8, isExternalRepresentation: b8, buffer: [^]byte, maxBufLen: Index, usedBufLen: ^Index) -> Index ---
- StringIsEncodingAvailable :: proc(encoding: StringEncoding) -> bool ---
+ StringIsEncodingAvailable :: proc(encoding: StringEncoding) -> b8 ---
@(link_name = "__CFStringMakeConstantString")
StringMakeConstantString :: proc "c" (#const c: cstring) -> String ---
diff --git a/core/sys/posix/arpa_inet.odin b/core/sys/posix/arpa_inet.odin
index 6edb9e535..70b12678c 100644
--- a/core/sys/posix/arpa_inet.odin
+++ b/core/sys/posix/arpa_inet.odin
@@ -50,7 +50,6 @@ foreign lib {
af: AF, // INET or INET6
src: cstring,
dst: rawptr, // either ^in_addr or ^in_addr6
- size: socklen_t, // size_of(dst^)
) -> pton_result ---
}
diff --git a/core/sys/posix/pthread.odin b/core/sys/posix/pthread.odin
index c7255baa3..733725e2c 100644
--- a/core/sys/posix/pthread.odin
+++ b/core/sys/posix/pthread.odin
@@ -124,7 +124,7 @@ foreign lib {
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_attr_getscope.html ]]
*/
- pthread_attr_setscope :: proc(attr: ^pthread_attr_t, contentionscope: ^Thread_Scope) -> Errno ---
+ pthread_attr_setscope :: proc(attr: ^pthread_attr_t, contentionscope: Thread_Scope) -> Errno ---
/*
Get the area of storage to be used for the created thread's stack.
@@ -400,7 +400,7 @@ when ODIN_OS == .Darwin {
PTHREAD_SCOPE_PROCESS :: 2
PTHREAD_SCOPE_SYSTEM :: 1
- pthread_t :: distinct u64
+ pthread_t :: distinct rawptr
pthread_attr_t :: struct {
__sig: c.long,
diff --git a/core/sys/posix/sys_mman.odin b/core/sys/posix/sys_mman.odin
index 2d51083dc..1bf3615dc 100644
--- a/core/sys/posix/sys_mman.odin
+++ b/core/sys/posix/sys_mman.odin
@@ -92,7 +92,12 @@ foreign lib {
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/shm_open.html ]]
*/
- shm_open :: proc(name: cstring, oflag: O_Flags, mode: mode_t) -> FD ---
+ when ODIN_OS == .Darwin {
+ // https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/shm_open.2.html
+ shm_open :: proc(name: cstring, oflag: O_Flags, #c_vararg args: ..any) -> FD ---
+ } else {
+ shm_open :: proc(name: cstring, oflag: O_Flags, mode: mode_t) -> FD ---
+ }
/*
Removes a shared memory object.