mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 22:58:46 +00:00
Add strings.ptr_from_string
This commit is contained in:
@@ -41,7 +41,7 @@ del *.ilk > NUL 2> NUL
|
|||||||
|
|
||||||
cl %compiler_settings% "src\main.cpp" ^
|
cl %compiler_settings% "src\main.cpp" ^
|
||||||
/link %linker_settings% -OUT:%exe_name% ^
|
/link %linker_settings% -OUT:%exe_name% ^
|
||||||
&& odin run examples/demo/demo.odin
|
&& odin build examples/demo/demo.odin -keep-temp-files
|
||||||
|
|
||||||
del *.obj > NUL 2> NUL
|
del *.obj > NUL 2> NUL
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ string_from_ptr :: proc(ptr: ^byte, len: int) -> string {
|
|||||||
return transmute(string)mem.Raw_String{ptr, len};
|
return transmute(string)mem.Raw_String{ptr, len};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ptr_from_string :: proc(str: string) -> ^byte {
|
||||||
|
d := transmute(mem.Raw_String)str;
|
||||||
|
return d.data;
|
||||||
|
}
|
||||||
|
|
||||||
unsafe_string_to_cstring :: proc(str: string) -> cstring {
|
unsafe_string_to_cstring :: proc(str: string) -> cstring {
|
||||||
d := transmute(mem.Raw_String)str;
|
d := transmute(mem.Raw_String)str;
|
||||||
|
|||||||
Reference in New Issue
Block a user