Add strings.ptr_from_string

This commit is contained in:
gingerBill
2019-12-01 18:06:49 +00:00
parent 9503440eb0
commit 6b5ea011e7
2 changed files with 5 additions and 1 deletions

View File

@@ -41,7 +41,7 @@ del *.ilk > NUL 2> NUL
cl %compiler_settings% "src\main.cpp" ^
/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

View File

@@ -42,6 +42,10 @@ string_from_ptr :: proc(ptr: ^byte, len: int) -> string {
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 {
d := transmute(mem.Raw_String)str;