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
hello from lua
[sol2] An error occurred and has been passed to an error handler: sol: runtime error: stack index 1, expected userdata, received sol.sol::d::u<int>: unrecognized userdata (not pushed by sol?) (bad argument into 'void(std::shared_ptr<const int>&)')
stack traceback:
[C]: in function 'base.intReader'
[string "..."]:4: in main chunk
terminate called after throwing an instance of 'sol::error'
what(): sol: runtime error: stack index 1, expected userdata, received sol.sol::d::u<int>: unrecognized userdata (not pushed by sol?) (bad argument into 'void(std::shared_ptr<const int>&)')
stack traceback:
[C]: in function 'base.intReader'
[string "..."]:4: in main chunk
Aborted (core dumped)
I use gcc 11.4.0 and sol2 v3.3.0 (revision eba8662), C++17.
For [v2.20.6] it's even worse as not even passing by value a shared_ptr<const TYPE> works.
I need to map some C++ interfaces to Lua and cannot change those interfaces. Many functions in those interfaces receive const shared_ptr<const TYPE>&.
For sol2 v3.3 I can work around this with a copy in a wrapped function and for 2.20.6, additionally I am wrapping the shared pointer into another struct and unwrapping that through the interfaces I need.
Can we get this fixed in the library or is there another 'simpler in some sense' way to work around this problem?
Am I missing something here?
Thank you
The text was updated successfully, but these errors were encountered:
EugenCazacu
changed the title
Calling functions which receive shared_ptr<const TYPE>& o const shared_ptr<const TYPE>& doesn't work
Calling functions which receive shared_ptr<const TYPE>& or const shared_ptr<const TYPE>& doesn't work
Nov 6, 2024
Calling functions which receive
shared_ptr<const TYPE>&
orconst shared_ptr<const TYPE>&
doesn't work:The output I receive:
I use gcc 11.4.0 and sol2 v3.3.0 (revision eba8662), C++17.
For [v2.20.6] it's even worse as not even passing by value a
shared_ptr<const TYPE>
works.I need to map some C++ interfaces to Lua and cannot change those interfaces. Many functions in those interfaces receive
const shared_ptr<const TYPE>&
.For sol2 v3.3 I can work around this with a copy in a wrapped function and for 2.20.6, additionally I am wrapping the shared pointer into another struct and unwrapping that through the interfaces I need.
Can we get this fixed in the library or is there another 'simpler in some sense' way to work around this problem?
Am I missing something here?
Thank you
The text was updated successfully, but these errors were encountered: