- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm using Boost & TBB together, and I ran into an ambiguous symbol error compiling with VS2008. It shows up in tbb_machine.h in the 3.0.6.175 version of TBB at line 595. The offending code is here:
#if __TBB_WORDSIZE==4 && __TBB_64BIT_ATOMICS
#if _MSC_VER
using tbb::internal::int64_t;
#endif
// On 32-bit platforms, there should be definition of __TBB_Store8 and __TBB_Load8
#ifndef __TBB_Store8
inline void __TBB_Store8 (volatile void *ptr, int64_t value) {
for(;;) {
int64_t result = *(int64_t *)ptr;
if( __TBB_CompareAndSwap8(ptr,value,result)==result ) break;
}
}
#endif
#ifndef __TBB_Load8
inline int64_t __TBB_Load8 (const volatile void *ptr) {
const int64_t anyvalue = 3264; // Could be anything, just the same for comparand and new value
return __TBB_CompareAndSwap8(const_cast(ptr),anyvalue,anyvalue);
}
#endif
template
struct __TBB_machine_load_store {
static inline T load_with_acquire(const volatile T& location) {
T to_return = (T)__TBB_Load8((const volatile void*)&location);
__TBB_release_consistency_helper();
return to_return;
}
static inline void store_with_release(volatile T& location, T value) {
__TBB_release_consistency_helper();
__TBB_Store8((volatile void *)&location,(int64_t)value);
}
};
#endif /* __TBB_WORDSIZE==4 */
The ambiguous symbol is the int64_t in the __TBB_Store8((volatile void *)&location,(int64_t)value); call. I tracked it back to an unnecessary "using namespace boost;" up in a header. Removing that worked, but looking at the code, the #if _MSC_VER should pull in an unambiguous type, but it doesn't. You can hack around it with something like:
#if _MSC_VER
using tbb::internal::int64_t;
typedef tbb::internal::int64_t int64_tt;
#else
typedef int64_t int64_tt;
#endif
and changing the call to __TBB_Store8((volatile void *)&location,(int64_tt)value);
to make it specific if you have to have boost types in the namespace, but, it's a hack. It's kind of a corner case, but I thought I should point it out.
Damien
I'm using Boost & TBB together, and I ran into an ambiguous symbol error compiling with VS2008. It shows up in tbb_machine.h in the 3.0.6.175 version of TBB at line 595. The offending code is here:
#if __TBB_WORDSIZE==4 && __TBB_64BIT_ATOMICS
#if _MSC_VER
using tbb::internal::int64_t;
#endif
// On 32-bit platforms, there should be definition of __TBB_Store8 and __TBB_Load8
#ifndef __TBB_Store8
inline void __TBB_Store8 (volatile void *ptr, int64_t value) {
for(;;) {
int64_t result = *(int64_t *)ptr;
if( __TBB_CompareAndSwap8(ptr,value,result)==result ) break;
}
}
#endif
#ifndef __TBB_Load8
inline int64_t __TBB_Load8 (const volatile void *ptr) {
const int64_t anyvalue = 3264; // Could be anything, just the same for comparand and new value
return __TBB_CompareAndSwap8(const_cast
}
#endif
template
struct __TBB_machine_load_store
static inline T load_with_acquire(const volatile T& location) {
T to_return = (T)__TBB_Load8((const volatile void*)&location);
__TBB_release_consistency_helper();
return to_return;
}
static inline void store_with_release(volatile T& location, T value) {
__TBB_release_consistency_helper();
__TBB_Store8((volatile void *)&location,(int64_t)value);
}
};
#endif /* __TBB_WORDSIZE==4 */
The ambiguous symbol is the int64_t in the __TBB_Store8((volatile void *)&location,(int64_t)value); call. I tracked it back to an unnecessary "using namespace boost;" up in a header. Removing that worked, but looking at the code, the #if _MSC_VER should pull in an unambiguous type, but it doesn't. You can hack around it with something like:
#if _MSC_VER
using tbb::internal::int64_t;
typedef tbb::internal::int64_t int64_tt;
#else
typedef int64_t int64_tt;
#endif
and changing the call to __TBB_Store8((volatile void *)&location,(int64_tt)value);
to make it specific if you have to have boost types in the namespace, but, it's a hack. It's kind of a corner case, but I thought I should point it out.
Damien
Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page