0

I'm having an issue linking my shared library against an OpenDDS (v3.9) static library because I am unable to find where this method signature is located.

Here's the error.

[exec] libs/mylib/ABTypeSupportImpl.cpp:74: error: undefined reference to 'OpenDDS::DCPS::operator<<(OpenDDS::DCPS::Serializer&, short)'
[exec] collect2: error: ld returned 1 exit status
[exec] make: *** [/tmp/mybuild/lib_ab/obj/local/armeabi-v7a/lib_ab.so] Error 1

ABTypeSupportImpl.cpp is auto generated from compiling the IDL. More of the same errors follow. Because of the namespace (OpenDDS::DCPS), I would think this would be found within the library libOpenDDS_Dcps.a, but using nm on this lib and then grep'ing for "operator" or "<<", produces no results. Could it be that name mangling is a bit stranger for overloaded operators? I ran this on every library file within $DDS_ROOT/lib, but found nothing.

And if I recompile the IDL and remove member fields of structs with datatypes such as short or long, then there are no errors and everything links fine.

Anyone know what library this method signature might be located?

Ender
  • 1,652
  • 2
  • 25
  • 50

1 Answers1

1

These operators are declared in 'dds/DCPS/Serializer.h' but implemented inline in Serializer.inl. Probably you compile OpenDDS with inlining enabled (its default) but when you compile your application you compile with inlining disabled.

Johnny Willemsen
  • 2,942
  • 1
  • 14
  • 16
  • Telling my program to inline or not, I think, is an internal optimization which the compiler may or may not choose to do. At least that is my understanding. I'm not specifically disabling anything in my compile. I've been trying various flags. – Ender Nov 17 '16 at 22:07
  • Also, I've tried GCC optimize-options with 01 and higher which seem to do quite a bit for inline functions, but still no go. – Ender Nov 18 '16 at 07:07
  • There is a define used in OpenDDS (and ACE) to enable or disable the inlined methods, it is a feature at the code level to use inlining or not. Try to add __ACE_INLINE__ or ACE_NO_INLINE to the compiler defines when compiling your code, check your OpenDDS compilation which one was used when compiling OpenDDS – Johnny Willemsen Nov 18 '16 at 07:42
  • DCPS/Serializer.cpp showed that it was compiling with __ACE_INLINE__ (couldn't tell from the *.inl file), and by adding that to my programs compile, it appears to have compiled successfully. Thanks. – Ender Nov 20 '16 at 00:29
  • Con't: Ah, just now understood that you were using the same ACE_INLINE as I was, but the markdown is hiding the pre/post underscores. – Ender Nov 20 '16 at 00:31