mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 12:48:14 +00:00
build_dll; Require an entry point procedure main
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#shared_global_scope
|
||||
|
||||
/*
|
||||
#import "fmt.odin"
|
||||
|
||||
__u128_mod :: proc(a, b: u128) -> u128 #link_name "__umodti3" {
|
||||
@@ -154,3 +155,4 @@ __u128_quo_mod :: proc(a, b: u128) -> (u128, u128) #link_name "__udivmodti4" {
|
||||
q.all = (q.all << 1) | (carry as u128)
|
||||
return q.all, r.all
|
||||
}
|
||||
*/
|
||||
|
||||
+5
-4
@@ -123,6 +123,7 @@ bprint_i64 :: proc(buffer: ^[]byte, value: i64) {
|
||||
bprint_u64(buffer, i as u64)
|
||||
}
|
||||
|
||||
/*
|
||||
bprint_u128 :: proc(buffer: ^[]byte, value: u128) {
|
||||
a := value transmute [2]u64
|
||||
if a[1] != 0 {
|
||||
@@ -138,7 +139,7 @@ bprint_i128 :: proc(buffer: ^[]byte, value: i128) {
|
||||
}
|
||||
bprint_u128(buffer, i as u128)
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
print__f64 :: proc(buffer: ^[]byte, value: f64, decimal_places: int) {
|
||||
@@ -353,8 +354,8 @@ bprint_any :: proc(buf: ^[]byte, arg: any) {
|
||||
case u32: bprint_u64(buf, i as u64)
|
||||
case i64: bprint_i64(buf, i)
|
||||
case u64: bprint_u64(buf, i)
|
||||
case i128: bprint_i128(buf, i)
|
||||
case u128: bprint_u128(buf, i)
|
||||
// case i128: bprint_i128(buf, i)
|
||||
// case u128: bprint_u128(buf, i)
|
||||
|
||||
case int: bprint_i64(buf, i as i64)
|
||||
case uint: bprint_u64(buf, i as u64)
|
||||
@@ -484,7 +485,7 @@ bprint_any :: proc(buf: ^[]byte, arg: any) {
|
||||
bprint_string(buf, "(raw_union)")
|
||||
case Procedure:
|
||||
bprint_type(buf, arg.type_info)
|
||||
bprint_string(buf, " @ 0x")
|
||||
bprint_string(buf, " @ ")
|
||||
bprint_pointer(buf, (arg.data as ^rawptr)^)
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
#import "fmt.odin"
|
||||
#import "os.odin"
|
||||
|
||||
set :: proc(data: rawptr, value: i32, len: int) -> rawptr #link_name "__mem_set" {
|
||||
set :: proc(data: rawptr, value: i32, len: int) -> rawptr #export "__mem_set" {
|
||||
llvm_memset_64bit :: proc(dst: rawptr, val: byte, len: int, align: i32, is_volatile: bool) #foreign "llvm.memset.p0i8.i64"
|
||||
llvm_memset_64bit(data, value as byte, len, 1, false)
|
||||
return data
|
||||
@@ -11,14 +11,14 @@ zero :: proc(data: rawptr, len: int) -> rawptr {
|
||||
return set(data, 0, len)
|
||||
}
|
||||
|
||||
copy :: proc(dst, src: rawptr, len: int) -> rawptr #link_name "__mem_copy" {
|
||||
copy :: proc(dst, src: rawptr, len: int) -> rawptr #export "__mem_copy" {
|
||||
// NOTE(bill): This _must_ implemented like C's memmove
|
||||
llvm_memmove_64bit :: proc(dst, src: rawptr, len: int, align: i32, is_volatile: bool) #foreign "llvm.memmove.p0i8.p0i8.i64"
|
||||
llvm_memmove_64bit(dst, src, len, 1, false)
|
||||
return dst
|
||||
}
|
||||
|
||||
copy_non_overlapping :: proc(dst, src: rawptr, len: int) -> rawptr #link_name "__mem_copy_non_overlapping" {
|
||||
copy_non_overlapping :: proc(dst, src: rawptr, len: int) -> rawptr #export "__mem_copy_non_overlapping" {
|
||||
// NOTE(bill): This _must_ implemented like C's memcpy
|
||||
llvm_memcpy_64bit :: proc(dst, src: rawptr, len: int, align: i32, is_volatile: bool) #foreign "llvm.memcpy.p0i8.p0i8.i64"
|
||||
llvm_memcpy_64bit(dst, src, len, 1, false)
|
||||
@@ -26,7 +26,7 @@ copy_non_overlapping :: proc(dst, src: rawptr, len: int) -> rawptr #link_name "_
|
||||
}
|
||||
|
||||
|
||||
compare :: proc(dst, src: rawptr, n: int) -> int #link_name "__mem_compare" {
|
||||
compare :: proc(dst, src: rawptr, n: int) -> int #export "__mem_compare" {
|
||||
// Translation of http://mgronhol.github.io/fast-strcmp/
|
||||
a := slice_ptr(dst as ^byte, n)
|
||||
b := slice_ptr(src as ^byte, n)
|
||||
|
||||
@@ -65,12 +65,13 @@ last_write_time :: proc(f: ^File) -> File_Time {
|
||||
last_write_time_by_name :: proc(name: string) -> File_Time {
|
||||
last_write_time: win32.FILETIME
|
||||
data: win32.WIN32_FILE_ATTRIBUTE_DATA
|
||||
|
||||
buf: [1024]byte
|
||||
path := buf[:0]
|
||||
fmt.bprint(^path, name, "\x00")
|
||||
|
||||
if win32.GetFileAttributesExA(path.data, win32.GetFileExInfoStandard, ^data) != 0 {
|
||||
assert(buf.count > name.count)
|
||||
|
||||
copy(buf[:], name as []byte)
|
||||
|
||||
if win32.GetFileAttributesExA(^buf[0], win32.GetFileExInfoStandard, ^data) != 0 {
|
||||
last_write_time = data.last_write_time
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user