Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when trying to load library. #348

Open
rogerbusquets97 opened this issue Oct 11, 2022 · 1 comment
Open

Crash when trying to load library. #348

rogerbusquets97 opened this issue Oct 11, 2022 · 1 comment

Comments

@rogerbusquets97
Copy link

I'm trying to load a dll that is registering types to rttr. But the application crashes when callling library.Load().
Apparently the issue is triggered here:
array_range<type> type::get_types() RTTR_NOEXCEPT { auto& type_list = detail::type_register_private::get_instance().get_type_storage(); return array_range<type>(&type_list[1], type_list.size() - 1); }
type_list has only 1 element, so it is out of bounds when accessing like type_list[1] i guess.
Maybe I am doing something wrong. I've been following the documentation though.
My dll has in a cpp file the following:
`#include "components.h"
#include <rttr/registration>
using namespace rttr;

RTTR_PLUGIN_REGISTRATION
{
rttr::registration::class_("test")
.constructor<>()
.property("i", &test::i);

rttr::registration::class_<test2>("test2")
.constructor<>()
.property("d", &test2::d);

}
And my application is trying to load it like this:library lib("game_gameplay"); // file suffix is not needed, will be automatically appended
lib.load();`

It crashes after calling load. AFAIK it is everything needed according to the documentation. Am I missing something.
dll is properly created. And I've been able to load it and get func ptr using windows API. But I'd like to use rttr method.

@tommybowles
Copy link

did you ever solve this? seeing the same thing

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

No branches or pull requests

2 participants