CppSharp
CppSharp copied to clipboard
[s]int8 in structures throw not implemented exception
In this function a NotImplementedException is thrown when a structure contains a member of type int8_t. Noting that the rest of this library appears to support signed bytes; however, this one particular class in the C# frontend doesn't handle them in its' two static functions
@ReeceSX Seems like an oversight, I think we need to add the following line, along with a test:
case PrimitiveType.Char:
+ case PrimitiveType.SChar:
signed = true;
return (targetInfo.CharWidth, targetInfo.CharAlign);
Do you wanna try sending a PR fixing this?
Re-reading this code, I'm thinking we might also have another bug here. Right now we just assume that char will always be signed, but I think that may not be the case with -funsigned-char.
EDIT: On further thought, maybe that is already handled by the thought that Clang already returns.
For reference, here is the code where Clang figures out what signedness to use: https://github.com/llvm/llvm-project/blob/4389a413e2129d7d55ee779638b649aa852b6f8a/clang/lib/Driver/ToolChains/Clang.cpp#L1438
I'm unable to work on this right; however, if it helps, the target toolchain was msvc. Perhaps there is some deviation between clangs internal ABI expectations based on the MSVCToolChain driver.
I had the same Problem with MSVC. Adding case PrimitiveType.SChar: fixed it for me.
We're running into the same issue with NuGet release 1.0.1.