Skip to content

Comments

Fix: clang_getClangVersion() does not return ctypes.c_char_p#155

Open
kienanstewart wants to merge 1 commit intotrolldbois:masterfrom
kienanstewart:fix-clangGetVersion_restype
Open

Fix: clang_getClangVersion() does not return ctypes.c_char_p#155
kienanstewart wants to merge 1 commit intotrolldbois:masterfrom
kienanstewart:fix-clangGetVersion_restype

Conversation

@kienanstewart
Copy link

The return value of clang_getClangVersion() is a CXString structure. Depending on the architecture the structure can be returned on the stack or via a register.

When assuming it is a ctypes.c_char_p, the ctypes FFI call will segfault upon return on armhf due to not properly handling how the architecture is returning the data.

Properly setting the return type for clang_getClangVersion() will avoid the segfault.

The return value of `clang_getClangVersion()` is a CXString
structure. Depending on the architecture the structure can be returned
on the stack or via a register.

When assuming it is a `ctypes.c_char_p`, the ctypes FFI call will
segfault upon return on armhf due to not properly handling how the
architecture is returning the data.

Properly setting the return type for `clang_getClangVersion()` will
avoid the segfault.

Signed-off-by: Kienan Stewart <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant