You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(go): avoid using unsafe.Pointer for passing handles (#195)
Functions that receive a `void*` in the C world must be called with an `unsafe.Pointer` from the Go world. However, we are not really passing a pointer, but a "handle", and coercing a handle into an `unsafe.Pointer` is problematic (`go vet` complains with "possible misuse of unsafe.Pointer", and it could cause a panic as described in https://i.hsfzxjy.site/invalid-pointer-will-bite-you/).
The solution is introducing small C stub functions that receive an `uintptr_t` instead of a `void*`, and the call the original function, casting the `uintptr_t` into `void*`.
0 commit comments