Closed SnapperTT closed 4 years ago
The library compiles fine. The attached test program also compiles and executes without issue with gcc 9.2.0 and mingw-gcc 9.2.0.
Compiling with clang via osxcross on linux results in a very spammy linker error.
Linking error (~70 lines)
$ x86_64-apple-darwin18-clang++ -mmacosx-version-min=10.9 rttr_test.cpp -I extlib/include --std=c++17 -L extlib/bin_osx64/ -lrttr_core -o rttr_test Undefined symbols for architecture x86_64: "rttr::detail::string_to_int(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool*)", referenced from: rttr::detail::convert_from<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::to(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, signed char&) in rttr_test-ee9c2d.o rttr::detail::convert_from<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::to(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, short&) in rttr_test-ee9c2d.o rttr::detail::convert_from<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::to(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int&) in rttr_test-ee9c2d.o rttr::detail::convert_from<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::to(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned char&) in rttr_test-ee9c2d.o rttr::detail::convert_from<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::to(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned short&) in rttr_test-ee9c2d.o "rttr::detail::type_register::custom_name(rttr::type&, rttr::basic_string_view<char, std::__1::char_traits<char> >)", referenced from: rttr::registration::class_<C>::class_(rttr::basic_string_view<char, std::__1::char_traits<char> >) in rttr_test-ee9c2d.o "rttr::detail::string_to_bool(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool*)", referenced from: rttr::detail::convert_from<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::to(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool&) in rttr_test-ee9c2d.o "rttr::detail::to_enumeration(rttr::basic_string_view<char, std::__1::char_traits<char> >, rttr::argument&)", referenced from: rttr::detail::convert_from<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::to_enum(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rttr::argument&) in rttr_test-ee9c2d.o "rttr::detail::string_to_float(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool*)", referenced from: rttr::detail::convert_from<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::to(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, float&) in rttr_test-ee9c2d.o "rttr::detail::string_to_ulong(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool*)", referenced from: rttr::detail::convert_from<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::to(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int&) in rttr_test-ee9c2d.o "rttr::detail::string_to_double(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool*)", referenced from: rttr::detail::convert_from<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::to(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, double&) in rttr_test-ee9c2d.o "rttr::detail::method_wrapper_base::method_wrapper_base(rttr::basic_string_view<char, std::__1::char_traits<char> >, rttr::type)", referenced from: rttr::detail::method_wrapper<int (C::*)(int&, char const*), (rttr::access_levels)0, rttr::detail::default_invoke, rttr::detail::default_args<>, rttr::detail::parameter_infos<rttr::detail::parameter_info_wrapper<int&, 0ul, rttr::detail::no_param_name, void>, rttr::detail::parameter_info_wrapper<char const*, 1ul, rttr::detail::no_param_name, void> >, 1ul>::method_wrapper(rttr::basic_string_view<char, std::__1::char_traits<char> >, rttr::type, int (C::*)(int&, char const*), std::__1::array<rttr::detail::metadata, 1ul>, rttr::detail::parameter_infos<rttr::detail::parameter_info_wrapper<int&, 0ul, rttr::detail::no_param_name, void>, rttr::detail::parameter_info_wrapper<char const*, 1ul, rttr::detail::no_param_name, void> >) in rttr_test-ee9c2d.o rttr::detail::method_wrapper<int (C::*)(int&, char const*), (rttr::access_levels)0, rttr::detail::default_invoke, rttr::detail::default_args<>, rttr::detail::parameter_infos<rttr::detail::parameter_info_wrapper<int&, 0ul, rttr::detail::no_param_name, void>, rttr::detail::parameter_info_wrapper<char const*, 1ul, rttr::detail::no_param_name, void> >, 0ul>::method_wrapper(rttr::basic_string_view<char, std::__1::char_traits<char> >, rttr::type, int (C::*)(int&, char const*), std::__1::array<rttr::detail::metadata, 0ul>, rttr::detail::parameter_infos<rttr::detail::parameter_info_wrapper<int&, 0ul, rttr::detail::no_param_name, void>, rttr::detail::parameter_info_wrapper<char const*, 1ul, rttr::detail::no_param_name, void> >) in rttr_test-ee9c2d.o "rttr::detail::string_to_long_long(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool*)", referenced from: rttr::detail::convert_from<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::to(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, long long&) in rttr_test-ee9c2d.o "rttr::detail::string_to_ulong_long(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool*)", referenced from: rttr::detail::convert_from<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::to(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long long&) in rttr_test-ee9c2d.o "rttr::detail::property_wrapper_base::property_wrapper_base(rttr::basic_string_view<char, std::__1::char_traits<char> >, rttr::type)", referenced from: rttr::detail::property_wrapper<rttr::detail::member_object_ptr, int C::*, void, (rttr::access_levels)0, rttr::detail::return_as_copy, rttr::detail::set_value, 1ul>::property_wrapper(rttr::basic_string_view<char, std::__1::char_traits<char> >, rttr::type, int C::*, std::__1::array<rttr::detail::metadata, 1ul>) in rttr_test-ee9c2d.o rttr::detail::property_wrapper<rttr::detail::member_object_ptr, double C::*, void, (rttr::access_levels)0, rttr::detail::return_as_copy, rttr::detail::set_value, 2ul>::property_wrapper(rttr::basic_string_view<char, std::__1::char_traits<char> >, rttr::type, double C::*, std::__1::array<rttr::detail::metadata, 2ul>) in rttr_test-ee9c2d.o rttr::detail::property_wrapper<rttr::detail::member_object_ptr, double C::*, void, (rttr::access_levels)0, rttr::detail::return_as_copy, rttr::detail::set_value, 0ul>::property_wrapper(rttr::basic_string_view<char, std::__1::char_traits<char> >, rttr::type, double C::*, std::__1::array<rttr::detail::metadata, 0ul>) in rttr_test-ee9c2d.o rttr::detail::property_wrapper<rttr::detail::member_object_ptr, int C::*, void, (rttr::access_levels)0, rttr::detail::return_as_copy, rttr::detail::set_value, 0ul>::property_wrapper(rttr::basic_string_view<char, std::__1::char_traits<char> >, rttr::type, int C::*, std::__1::array<rttr::detail::metadata, 0ul>) in rttr_test-ee9c2d.o "rttr::detail::registration_executer::add_registration_func(void const*, std::__1::function<void ()>)", referenced from: rttr::registration::bind<rttr::detail::ctor, C, rttr::detail::public_access>::bind(std::__1::shared_ptr<rttr::detail::registration_executer> const&) in rttr_test-ee9c2d.o rttr::registration::bind<rttr::detail::prop, C, int C::*, rttr::detail::public_access>::bind(std::__1::shared_ptr<rttr::detail::registration_executer> const&, rttr::basic_string_view<char, std::__1::char_traits<char> >, int C::*) in rttr_test-ee9c2d.o rttr::registration::bind<rttr::detail::prop, C, double C::*, rttr::detail::public_access>::bind(std::__1::shared_ptr<rttr::detail::registration_executer> const&, rttr::basic_string_view<char, std::__1::char_traits<char> >, double C::*) in rttr_test-ee9c2d.o rttr::registration::bind<rttr::detail::meth, C, int (C::*)(int&, char const*), rttr::detail::public_access>::bind(std::__1::shared_ptr<rttr::detail::registration_executer> const&, rttr::basic_string_view<char, std::__1::char_traits<char> >, int (C::*)(int&, char const*)) in rttr_test-ee9c2d.o rttr::registration::bind<rttr::detail::meth, C, int (C::*)(int&, char const*), rttr::detail::public_access>::~bind() in rttr_test-ee9c2d.o rttr::registration::bind<rttr::detail::prop, C, double C::*, rttr::detail::public_access>::~bind() in rttr_test-ee9c2d.o rttr::registration::bind<rttr::detail::prop, C, int C::*, rttr::detail::public_access>::~bind() in rttr_test-ee9c2d.o ... "rttr::detail::to_string(double, bool*)", referenced from: __ZN4rttr6detail10convert_toIdNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEENS2_9enable_ifIXsr3std7is_sameIT0_S8_EE5valueEbE4typeERKT_RSA_ in rttr_test-ee9c2d.o "rttr::detail::to_string(int, bool*)", referenced from: __ZN4rttr6detail10convert_toIiNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEENS2_9enable_ifIXsr3std7is_sameIT0_S8_EE5valueEbE4typeERKT_RSA_ in rttr_test-ee9c2d.o "rttr::detail::to_string(unsigned int, bool*)", referenced from: __ZN4rttr6detail10convert_toIjNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEENS2_9enable_ifIXsr3std7is_sameIT0_S8_EE5valueEbE4typeERKT_RSA_ in rttr_test-ee9c2d.o "rttr::variant::to_string(bool*) const", referenced from: rttr::detail::variant_data_base_policy<int, rttr::detail::variant_data_policy_arithmetic<int>, rttr::detail::default_type_converter<int, rttr::detail::convert_from<int> > >::invoke(rttr::detail::variant_policy_operation, std::__1::aligned_storage<8ul, 8ul>::type const&, rttr::detail::argument_wrapper) in rttr_test-ee9c2d.o rttr::detail::variant_data_base_policy<int*, rttr::detail::variant_data_policy_small<int*, rttr::detail::empty_type_converter<int*> >, rttr::detail::empty_type_converter<int*> >::invoke(rttr::detail::variant_policy_operation, std::__1::aligned_storage<8ul, 8ul>::type const&, rttr::detail::argument_wrapper) in rttr_test-ee9c2d.o rttr::detail::variant_data_base_policy<RTTR_MetaData_Type, rttr::detail::variant_data_policy_small<RTTR_MetaData_Type, rttr::detail::empty_type_converter<RTTR_MetaData_Type> >, rttr::detail::default_type_converter<RTTR_MetaData_Type, rttr::detail::convert_from_enum<RTTR_MetaData_Type> > >::invoke(rttr::detail::variant_policy_operation, std::__1::aligned_storage<8ul, 8ul>::type const&, rttr::detail::argument_wrapper) in rttr_test-ee9c2d.o rttr::detail::variant_data_base_policy<RTTR_MetaData_Type*, rttr::detail::variant_data_policy_small<RTTR_MetaData_Type*, rttr::detail::empty_type_converter<RTTR_MetaData_Type*> >, rttr::detail::empty_type_converter<RTTR_MetaData_Type*> >::invoke(rttr::detail::variant_policy_operation, std::__1::aligned_storage<8ul, 8ul>::type const&, rttr::detail::argument_wrapper) in rttr_test-ee9c2d.o rttr::detail::variant_data_base_policy<char*, rttr::detail::variant_data_policy_small<char*, rttr::detail::empty_type_converter<char*> >, rttr::detail::empty_type_converter<char*> >::invoke(rttr::detail::variant_policy_operation, std::__1::aligned_storage<8ul, 8ul>::type const&, rttr::detail::argument_wrapper) in rttr_test-ee9c2d.o rttr::detail::variant_data_base_policy<double, rttr::detail::variant_data_policy_arithmetic<double>, rttr::detail::default_type_converter<double, rttr::detail::convert_from<double> > >::invoke(rttr::detail::variant_policy_operation, std::__1::aligned_storage<8ul, 8ul>::type const&, rttr::detail::argument_wrapper) in rttr_test-ee9c2d.o rttr::detail::variant_data_base_policy<double*, rttr::detail::variant_data_policy_small<double*, rttr::detail::empty_type_converter<double*> >, rttr::detail::empty_type_converter<double*> >::invoke(rttr::detail::variant_policy_operation, std::__1::aligned_storage<8ul, 8ul>::type const&, rttr::detail::argument_wrapper) in rttr_test-ee9c2d.o ... "typeinfo for rttr::detail::method_wrapper_base", referenced from: typeinfo for rttr::detail::method_wrapper<int (C::*)(int&, char const*), (rttr::access_levels)0, rttr::detail::default_invoke, rttr::detail::default_args<>, rttr::detail::parameter_infos<rttr::detail::parameter_info_wrapper<int&, 0ul, rttr::detail::no_param_name, void>, rttr::detail::parameter_info_wrapper<char const*, 1ul, rttr::detail::no_param_name, void> >, 1ul> in rttr_test-ee9c2d.o typeinfo for rttr::detail::method_wrapper<int (C::*)(int&, char const*), (rttr::access_levels)0, rttr::detail::default_invoke, rttr::detail::default_args<>, rttr::detail::parameter_infos<rttr::detail::parameter_info_wrapper<int&, 0ul, rttr::detail::no_param_name, void>, rttr::detail::parameter_info_wrapper<char const*, 1ul, rttr::detail::no_param_name, void> >, 0ul> in rttr_test-ee9c2d.o "typeinfo for rttr::detail::property_wrapper_base", referenced from: typeinfo for rttr::detail::property_wrapper<rttr::detail::member_object_ptr, int C::*, void, (rttr::access_levels)0, rttr::detail::return_as_copy, rttr::detail::set_value, 1ul> in rttr_test-ee9c2d.o typeinfo for rttr::detail::property_wrapper<rttr::detail::member_object_ptr, double C::*, void, (rttr::access_levels)0, rttr::detail::return_as_copy, rttr::detail::set_value, 2ul> in rttr_test-ee9c2d.o typeinfo for rttr::detail::property_wrapper<rttr::detail::member_object_ptr, double C::*, void, (rttr::access_levels)0, rttr::detail::return_as_copy, rttr::detail::set_value, 0ul> in rttr_test-ee9c2d.o typeinfo for rttr::detail::property_wrapper<rttr::detail::member_object_ptr, int C::*, void, (rttr::access_levels)0, rttr::detail::return_as_copy, rttr::detail::set_value, 0ul> in rttr_test-ee9c2d.o "typeinfo for rttr::detail::destructor_wrapper_base", referenced from: typeinfo for rttr::detail::destructor_wrapper<C> in rttr_test-ee9c2d.o "typeinfo for rttr::detail::constructor_wrapper_base", referenced from: typeinfo for rttr::detail::constructor_wrapper<C, rttr::detail::class_ctor, (rttr::access_levels)0, rttr::detail::as_std_shared_ptr, 0ul, rttr::detail::default_args<>, rttr::detail::parameter_infos<>> in rttr_test-ee9c2d.o "typeinfo for rttr::detail::parameter_info_wrapper_base", referenced from: typeinfo for rttr::detail::parameter_info_wrapper<int&, 0ul, rttr::detail::no_param_name, void> in rttr_test-ee9c2d.o typeinfo for rttr::detail::parameter_info_wrapper<char const*, 1ul, rttr::detail::no_param_name, void> in rttr_test-ee9c2d.o ld: symbol(s) not found for architecture x86_64 clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
This is definately linking against rttr_core, removing -lrttr_core makes the linker error grow to ~240 lines
-lrttr_core
Test program:
#include "extlib/include/rttr/registration.h" #include <iostream> // debugging rttr // x86_64-apple-darwin18-clang++ -mmacosx-version-min=10.9 rttr_test.cpp -I extlib/include --std=c++17 -L extlib/bin_osx64/ -lrttr_core enum class RTTR_MetaData_Type { FLAGS, DOCUMENTATION }; // Macros to add flags & documentation #define RTTR_METH_1_ARGS(C) error #define RTTR_METH_2_ARGS(C, X) method(#X, &C::X) #define RTTR_METH_3_ARGS(C, X, MFLAGS) method(#X, &C::X)( rttr::metadata(RTTR_MetaData_Type::FLAGS,uint32_t(MFLAGS)) ) #define RTTR_METH_4_ARGS(C, X, MFLAGS, DOC) method(#X, &C::X)( rttr::metadata(RTTR_MetaData_Type::FLAGS,uint32_t(MFLAGS)), rttr::metadata(RTTR_MetaData_Type::DOCUMENTATION,DOC) ) #define RTTR_PROP_1_ARGS(C) error #define RTTR_PROP_2_ARGS(C, X) property(#X, &C::X) #define RTTR_PROP_3_ARGS(C, X, MFLAGS) property(#X, &C::X)( rttr::metadata(RTTR_MetaData_Type::FLAGS,uint32_t(MFLAGS) ) #define RTTR_PROP_4_ARGS(C, X, MFLAGS, DOC) property(#X, &C::X)( rttr::metadata(RTTR_MetaData_Type::FLAGS,uint32_t(MFLAGS)), rttr::metadata(RTTR_MetaData_Type::DOCUMENTATION,DOC) ) // Auto documenting stuff #define RTTR_METH_AD_1_ARGS(C) error #define RTTR_METH_AD_2_ARGS(C, X) method(#X, &C::X)( rttr::metadata(RTTR_MetaData_Type::DOCUMENTATION, C::docfunc_ ## X) ) #define RTTR_METH_AD_3_ARGS(C, X, MFLAGS) method(#X, &C::X)( rttr::metadata(RTTR_MetaData_Type::FLAGS,uint32_t(MFLAGS)), rttr::metadata(RTTR_MetaData_Type::DOCUMENTATION, C::docfunc_ ## X) ) #define RTTR_PROP_AD_1_ARGS(C) error #define RTTR_PROP_AD_2_ARGS(C, X) property(#X, &C::X)( rttr::metadata(RTTR_MetaData_Type::DOCUMENTATION, C::docvar_ ## X) ) #define RTTR_PROP_AD_3_ARGS(C, X, MFLAGS) property(#X, &C::X)( rttr::metadata(RTTR_MetaData_Type::FLAGS,uint32_t(MFLAGS)), rttr::metadata(RTTR_MetaData_Type::DOCUMENTATION, C::docvar_ ## X) ) #define GET_5TH_ARG(arg1, arg2, arg3, arg4, arg5, ...) arg5 #define RTTR_METH_MACRO_CHOOSER(...) \ GET_5TH_ARG(__VA_ARGS__, RTTR_METH_4_ARGS, RTTR_METH_3_ARGS, \ RTTR_METH_2_ARGS, RTTR_METH_1_ARGS, ) #define RTTR_PROP_MACRO_CHOOSER(...) \ GET_5TH_ARG(__VA_ARGS__, RTTR_PROP_4_ARGS, RTTR_PROP_3_ARGS, \ RTTR_PROP_2_ARGS, RTTR_PROP_1_ARGS, ) #define GET_4TH_ARG(arg1, arg2, arg3, arg4, ...) arg4 #define RTTR_METH_AD_MACRO_CHOOSER(...) \ GET_4TH_ARG(__VA_ARGS__, RTTR_METH_AD_3_ARGS, \ RTTR_METH_AD_2_ARGS, RTTR_METH_AD_1_ARGS, ) #define RTTR_PROP_AD_MACRO_CHOOSER(...) \ GET_4TH_ARG(__VA_ARGS__, RTTR_PROP_AD_3_ARGS, \ RTTR_PROP_AD_2_ARGS, RTTR_PROP_AD_1_ARGS, ) #define RTTR_METH_MANUAL(...) RTTR_METH_MACRO_CHOOSER(__VA_ARGS__)(__VA_ARGS__) #define RTTR_PROP_MANUAL(...) RTTR_PROP_MACRO_CHOOSER(__VA_ARGS__)(__VA_ARGS__) #define RTTR_METH(...) RTTR_METH_AD_MACRO_CHOOSER(__VA_ARGS__)(__VA_ARGS__) #define RTTR_PROP(...) RTTR_PROP_AD_MACRO_CHOOSER(__VA_ARGS__)(__VA_ARGS__) #define RTTR_FLAG_NONE (0) #define RTTR_FLAG_LUA (1<<0) #define RTTR_FLAG_JSON (1<<1) #define RTTR_FLAG_BINSER (1<<2) #define RTTR_FLAG_JSON_BIN RTTR_FLAG_JSON | RTTR_FLAG_BINSER #define RTTR_FLAG_LUA_JSON_BIN RTTR_FLAG_LUA | RTTR_FLAG_JSON | RTTR_FLAG_BINSER #define DOCUMENT_FUNC(NAME,DOC, PROTOTYPE) inline static constexpr char * docfunc_ ## NAME = (char *) #PROTOTYPE " " DOC; PROTOTYPE #define DOCUMENT_VAR(NAME,DOC) inline static constexpr char * docvar_ ## NAME = (char *) DOC; #define DOCF(X,Y) DOCUMENT_FUNC(X,Y) #define DOCV(X,Y) DOCUMENT_VAR(X,Y) using namespace std; class C { public: C(){} int i; DOCV(i, "This is I"); double v; // Some vector int hidden; // Some internal stuff I don't want exposed DOCUMENT_FUNC (functionf, "Multiline definition " "This is foo's documentation", int functionf(int & foo, const char * bar)) { return 0; } }; template <typename T> string RTTI_getDoc(const T & p) { /// Attempt to extract doc/value as a string, or as a char array /// Returns a string string doc = ""; rttr::variant value = p.get_metadata(RTTR_MetaData_Type::DOCUMENTATION); value.convert(doc); char * v2 = 0; if (value.convert(v2)) doc = v2; return doc; } template <typename T> uint32_t RTTI_getFlags(const T & p) { /// Attempt to extract doc/value as a string, or as a char array /// Returns a string rttr::variant value = p.get_metadata(RTTR_MetaData_Type::FLAGS); uint32_t flags = 0; if (value.is_valid()) flags = value.get_value<uint32_t>(); return flags; } RTTR_REGISTRATION { using namespace rttr; registration::class_<C>("C") .constructor<>() .RTTR_PROP(C,i) .RTTR_PROP_MANUAL(C, v, RTTR_FLAG_LUA_JSON_BIN, "Some vector") .RTTR_METH(C,functionf) ; // Register lua rttr::type t = rttr::type::get<C>(); for (auto& prop : t.get_properties()) { uint32_t flags = RTTI_getFlags(prop); string doc = RTTI_getDoc(prop); std::cout << "name: " << prop.get_name() << "[" << flags << "] [" << doc << "]" << std::endl; } for (auto& meth : t.get_methods()) { uint32_t flags = RTTI_getFlags(meth); string doc = RTTI_getDoc(meth); string params = "("; bool first = true; for (auto& param : meth.get_parameter_infos()) { if (!first) params += ", "; params += param.get_type().get_name().to_string() + param.get_name().to_string(); first = false; } params += ") -> " + meth.get_return_type().get_name().to_string(); std::cout << "name: " << meth.get_name() << params << " [" << flags << "] [" << doc << "] " << std::endl; } std::cout << C::docvar_i << std::endl; exit(1); // REGISTER_LUA(C) // REGISTER_JSON(C) // REGISTER_BIN(C) } int main(int argc, char ** argv) { return 1; }
Compile with: x86_64-apple-darwin18-clang++ -mmacosx-version-min=10.9 rttr_test.cpp -I extlib/include --std=c++17 -L extlib/bin_osx64/ -lrttr_core -o rttr_test
x86_64-apple-darwin18-clang++ -mmacosx-version-min=10.9 rttr_test.cpp -I extlib/include --std=c++17 -L extlib/bin_osx64/ -lrttr_core -o rttr_test
I'm an idiot - I compiled the library with gcc and my program with clang. Closing
The library compiles fine. The attached test program also compiles and executes without issue with gcc 9.2.0 and mingw-gcc 9.2.0.
Compiling with clang via osxcross on linux results in a very spammy linker error.
Linking error (~70 lines)
This is definately linking against rttr_core, removing
-lrttr_core
makes the linker error grow to ~240 linesTest program:
Compile with:
x86_64-apple-darwin18-clang++ -mmacosx-version-min=10.9 rttr_test.cpp -I extlib/include --std=c++17 -L extlib/bin_osx64/ -lrttr_core -o rttr_test