mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-11 21:08:10 +00:00
Wrap entry point main around the C style main in the IR
This commit is contained in:
@@ -138,8 +138,8 @@ Type_Info :: struct #ordered {
|
||||
// This will be set by the compiler
|
||||
__type_table: []Type_Info;
|
||||
|
||||
__argv__: ^^u8;
|
||||
__argc__: i32;
|
||||
__argv__: ^^u8;
|
||||
|
||||
// IMPORTANT NOTE(bill): Must be in this order (as the compiler relies upon it)
|
||||
|
||||
|
||||
@@ -267,6 +267,9 @@ dlerror :: proc() -> string {
|
||||
|
||||
|
||||
_alloc_command_line_arguments :: proc() -> []string {
|
||||
// TODO(bill):
|
||||
return nil;
|
||||
args := make([]string, __argc__);
|
||||
for i in 0..__argc__ {
|
||||
args[i] = strings.to_odin_string((__argv__+i)^);
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ RTLD_NOLOAD :: 0x10;
|
||||
RTLD_FIRST :: 0x100;
|
||||
|
||||
|
||||
args: [dynamic]string;
|
||||
// "Argv" arguments converted to Odin strings
|
||||
args := _alloc_command_line_arguments();
|
||||
|
||||
_File_Time :: struct #ordered {
|
||||
seconds: i64,
|
||||
@@ -279,3 +280,12 @@ dlclose :: proc(handle: rawptr) -> bool #inline {
|
||||
dlerror :: proc() -> string {
|
||||
return strings.to_odin_string(unix_dlerror());
|
||||
}
|
||||
|
||||
|
||||
_alloc_command_line_arguments :: proc() -> []string {
|
||||
args := make([]string, __argc__);
|
||||
for i in 0..__argc__ {
|
||||
args[i] = strings.to_odin_string((__argv__+i)^);
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user