|
Boost Users : |
From: David Matz (david.matz_at_[hidden])
Date: 2008-04-22 03:22:17
Thank you guys,
the patch from Niels solved the problem! A good hint.
I run in another problem when multiple files inside a project include the
extension headers. The operators in typeinfo.hpp are compiled into different
object files which produces errors at link time. To solve that I declared these
functions as inline see patch below.
Index: typeinfo.hpp
===================================================================
--- typeinfo.hpp 2008-04-14 15:18:38.000000000 +0200
+++ typeinfo_mod.hpp 2008-04-14 16:04:28.000000000 +0200
@@ -42,17 +42,17 @@
#if defined(__APPLE__) || defined(__GNUC__) ||
defined(BOOST_EXTENSION_FORCE_FAST_TYPEINFO)
namespace boost {
namespace extensions {
-bool operator<(const default_type_info& first,
+inline bool operator<(const default_type_info& first,
const default_type_info& second) {
return &first.type < &second.type;
}
-bool operator==(const default_type_info& first,
+inline bool operator==(const default_type_info& first,
const default_type_info& second) {
return &first.type == &second.type;
}
-bool operator>(const default_type_info& first,
+inline bool operator>(const default_type_info& first,
const default_type_info& second) {
return &first.type > &second.type;
}
@@ -61,17 +61,17 @@
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
#include <string>
namespace boost { namespace extensions {
-bool operator<(const default_type_info& first,
+inline bool operator<(const default_type_info& first,
const default_type_info& second) {
return std::strcmp(first.type.raw_name(), second.type.raw_name()) < 0;
}
-bool operator==(const default_type_info& first,
+inline bool operator==(const default_type_info& first,
const default_type_info& second) {
return std::strcmp(first.type.raw_name(), second.type.raw_name()) == 0;
}
-bool operator>(const default_type_info& first,
+inline bool operator>(const default_type_info& first,
const default_type_info& second) {
return std::strcmp(first.type.raw_name(), second.type.raw_name()) > 0;
}
@@ -80,17 +80,17 @@
#else // OTHER OS
#include <string>
namespace boost { namespace extensions {
-bool operator<(const default_type_info& first,
+inline bool operator<(const default_type_info& first,
const default_type_info& second) {
return std::strcmp(first.type.name(), second.type.name()) < 0;
}
-bool operator==(const default_type_info& first,
+inline bool operator==(const default_type_info& first,
const default_type_info& second) {
return std::strcmp(first.type.name(), second.type.name()) == 0;
}
-bool operator>(const default_type_info& first,
+inline bool operator>(const default_type_info& first,
const default_type_info& second) {
return std::strcmp(first.type.name(), second.type.name()) > 0;
}
Jeremy Pack wrote:
> Thanks! That looks like it ought to fix it.
>
> I updated the Sandbox with the proposed fix, and was able to successfully
> build and run the tests and examples on MSVC 9 and GCC 4. Please let me know
> if that fixes the issue for MSVC 7.1.
>
> Jeremy
>
> On Sat, Apr 19, 2008 at 9:20 AM, Niels Dekker - mail address until
> 2008-12-31 <nd_mail_address_valid_until_2008-12-31_at_[hidden]> wrote:
>
>> David Matz wrote:
>>> error: error C2039: 'boost::get': Ist kein Element von
>>> 'boost::extensions::shared_library'
>> Jeremy Pack wrote:
>>> Please add the command line option /P to your build - this will output
>>> the preprocessed version of your file test_extension_and_optional.cpp.
>>> Then send this to me - I might be able to figure out what is going on.
>>> It looks like one of the preprocessor macros used by
>>> Boost.PreProcessor isn't working
>> It seems to me that the compile error isn't caused by Boost.PreProcessor.
>> Actually I think I've found a workaround: Explicitly qualify the
>> shared_library::get member function call in extension/convenience.hpp
>> (line 29),
>> (by adding the class name, "shared_library::") and the MSVC 7.1 error
>> message
>> disappears!
>>
>>
>> HTH, Niels
>>
>> PS Here's the patch:
>>
>> Index: convenience.hpp
>>
>> ===================================================================
>>
>> --- convenience.hpp (revision 44584)
>>
>> +++ convenience.hpp (working copy)
>>
>> @@ -26,7 +26,7 @@
>>
>> return;
>> }
>> void (*func)(factory_map &) =
>> - lib.get<void, factory_map &>(external_function_name);
>> + lib.shared_library::get<void, factory_map
>> &>(external_function_name);
>> if (!func) {
>> return;
>>
>
-- David Matz ---------------------------- Spatial View GmbH mail: david.matz_at_[hidden] site: www.spatialview.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net