Is StringLiteral intended for handling c strings?
Suppose I have c-library function in
Compile to shared library:
The value printed by the above program is correct. However, the length of the StringLiteral is wrong.
Is something wrong with the StringLiteral implementation, or am I misunderstanding how it can be used?
thing.c that returns a string. What datatype should I use to represent the return type for a FFI binding in a Mojo program?Compile to shared library:
clang -shared -o libThing.so thing.cOption 1: UInt8 pointer
If I specify that the return type is a char/uint8 pointer, then I need to write a functionparseCharArrayToString that builds a string by loading each character until a null terminator is reached. This approach works fine.Option 2: StringLiteral (Broken?)
I could instead specify the return type to be aStringLiteral.The value printed by the above program is correct. However, the length of the StringLiteral is wrong.
Is something wrong with the StringLiteral implementation, or am I misunderstanding how it can be used?
