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
How to properly handle opaque C pointers? They are very popular in many C libraries.
Right now I doing so, consider glfw where GLFWwindow and GLFWmonitor are opaque pointers.
Consider binding:
And I have to modify all the related API to afford the newly introduced proxy holder OpaquePtr for incomplete types.
I completely understand that sol2 needs complete types so it can participate in its type system so it can catch type mismatch errors instead of letting the program crash. @ThePhD Is this the best of what could be done or better solutions exist?
Thanks.
Edit:
Actually sol is trying to check against is_base_of_v trait at some point in sol::is_container and sol::is_lua_reference.
So specializing sol::is_lua_reference<TYPE> : std::false_type with the opaque type solves the problem.
Is it worth introducing a new traits is_c_type?
The text was updated successfully, but these errors were encountered:
How to properly handle opaque C pointers? They are very popular in many C libraries.
Right now I doing so, consider
glfw
whereGLFWwindow
andGLFWmonitor
are opaque pointers.Consider binding:
Binding it like:
Fails to compile with
incomplete type 'GLFWwindow' used in type trait expression
.So I am binding it while introducing a proxy holder like so:
And I have to modify all the related API to afford the newly introduced proxy holder
OpaquePtr
for incomplete types.I completely understand that sol2 needs complete types so it can participate in its type system so it can catch type mismatch errors instead of letting the program crash.
@ThePhD Is this the best of what could be done or better solutions exist?
Thanks.
Edit:
Actually
sol
is trying to check againstis_base_of_v
trait at some point insol::is_container
andsol::is_lua_reference
.So specializing
sol::is_lua_reference<TYPE> : std::false_type
with the opaque type solves the problem.Is it worth introducing a new traits
is_c_type
?The text was updated successfully, but these errors were encountered: