Question about the FFI, unsafe_cstr_ptr, and PathLike
When calling into a dylib from mojo using the FFI, the char* I pass is seemingly freed before the c function receives it - the following code's output won't show the path. However, if I artificially "retain" the
path_string until after the external call, it succeeds. It also succeeds if I use a string literal instead of a Path. Is this a bug or is this a misunderstanding on my part of the ASAP deconstruction?
Follow-up, if I replace the type of the fn arg with PathLike, the compiler throws could not deduce positional-only parameter #0 of callee '__fspath__'. I would think I should be able to use a PathLike here to get an __fspath__ without the explicit Path type, right?
Thanks!0 Replies