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
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;
} 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.
The text was updated successfully, but these errors were encountered:
Welp sad to see no one has commented on this, but I have the same issue, I've fixed it by changing the code to &type_list[0], and it does call my registration function on the DLL, however, it doesn't seem to get registered properly as the returned type is invalid (type::is_valid == false). Would be nice if one of the devs could chip in!
So, I guess I have a partial solution, the reason why the app crashes on the line type_list[1] is when no types are registered and if you try to call this function you get the crash. I'll assume this is a bug the devs missed because if you use the lib you will likely have at least one type registered. However, that brings us to the issue of having types registered but still getting the crash, this happens when you statically link to the library, specifically with the option BUILD_STATIC ON. When done this way and using shared libraries across your app, each instance of a shared lib gets its different static storage, defeating the point of it. So now you know the cause, I don't have a fix other than using RTTR as a shared lib, unfortunately.
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);
}
And my application is trying to load it like this:
library lib("game_gameplay"); // file suffix is not needed, will be automatically appendedlib.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.
The text was updated successfully, but these errors were encountered: