so try port boost.extension samples linux.
the sample described here. here code port (classes animals, animal prototype, main app, general all port idea described here, , some current linux progress here (some samples work needed!)). when compile sample under linux compiles, finds library animals outputs:
animals not found! which shall happen if(factories.empty()).
i try port extension samples onto crossplatform base - have tried same code under windows - works charm! finds animals , outputs:
creating animal using factory: cougar factory created animal: cougar age: 2 creating animal using factory: leopard factory created animal: leopard age: 3 creating animal using factory: puma factory created animal: puma age: 4 creating animal using factory: wildcat factory created animal: wildcat age: 5 so... why behaves on linux same code? why works under windows?
update:
so how build stuff premake:
- you svn here (only folder required)
- you get premake platform or build source , put folder downloaded svn
- you should have official boost compiled , installed (please read readme.txt file provide in directory) needed:
- boost c++ library's (we tested version 1.4.16)
- boost-extension ( use latest revision , adress part of boost 'boost/extension/
**' we had make chandes (actually one) boost extension provide insideboost.extension.tutorial/libs/boost/extension/folder when downloaded svn got it, header only ) - boost-reflection ( use because of tutorial , use latest revision , adress part of boost 'boost/reflection/
**' *and simplness recommend putboost.extension.tutorial/libs/boost/reflection* )
- now when official boost in system, header boost-reflection , boost-extension in
boost.extension.tutorial/libs/boostfolder, premake4 executable insideboost.extension.tutorial/folder can callboost.extension.tutorial/ premake4-build-windows.baton windows sln visual studio orboost.extension.tutorial/ premake-build.shmakefiles. - you can find generated solution/makefiles inside generated projects folder.
- have luck!=)
update 2:
project files for windows , linux in svn can aroung project creation premake - have boost, our svn, , reflection headers lib.
i debugged things on linux, news:
you running bullet no. 3 jeremy pack's post:
rtti not function expected across dll boundaries. check out type_info classes see how deal that.
i have tiny workaround patch (below) boost/extension/impl/typeinfo.hpp (but need talk maintainer of boost extension, really). not rely on builtin comparison rtti typeinfo's.
looking @ typeinfo.hpp, seems windows never uses typeinfo comparison, decided test 'strcmp' fallback method, , voila:
$ ld_library_path=. ./simple-inheritance creating animal using factory: cougar factory created animal: cougar age: 2 creating animal using factory: leopard factory created animal: leopard age: 3 creating animal using factory: puma factory created animal: puma age: 4 creating animal using factory: wildcat factory created animal: wildcat age: 5 in particular, can show type lookup convertible_ fails @ type_map.hpp, line 68;
- when conversion called extension dll itself, conversion happily finds match using rtti.
- however, when 'same' .get() done test application (across dll boundaries, i.e.) rtti different , no such match found, , line 74/75 hit:
.
73 if (it == instances_.end()) { 74 holder = new type_holder<storedtype>; 75 = instances_.insert(std::make_pair(t, holder)).first; 76 } patch
diff --git a/boost.extension.tutorial/libs/boost/extension/impl/typeinfo.hpp b/boost.extension.tutorial/libs/boost/extension/impl/typeinfo.hpp index 843fed2..09fc353 100644 --- a/boost.extension.tutorial/libs/boost/extension/impl/typeinfo.hpp +++ b/boost.extension.tutorial/libs/boost/extension/impl/typeinfo.hpp @@ -50,7 +50,7 @@ struct type_info_handler<default_type_info, classtype> // list should expanded platforms // compare type_info across shared library boundaries. -#if defined(__apple__) || defined(__gnuc__) || \ +#if defined(__apple__) || \ defined(boost_extension_force_fast_typeinfo) namespace boost { namespace extensions { @@ -90,7 +90,7 @@ inline bool operator>(const default_type_info& first, } // namespace extensions } // namespace boost #else // other os -#include <string> +#include <cstring> namespace boost { namespace extensions { inline bool operator<(const default_type_info& first, const default_type_info& second) {
Comments
Post a Comment