DDS in a DLL

14 posts / 0 new
Last post
Offline
Last seen: 11 years 9 months ago
Joined: 03/27/2012
Posts: 3
DDS in a DLL

Hi,

 

I am struggling to create a basic DLL that uses DDS. Which pre-compiler flag do I need to specify? I currently have:

 

NDDS_DLL_VARIABLE;

NDDS_USER_DLL_EXPORT;

RTI_WIN32

 

I keep getting loads of unresolved symbols.

 

Thank you

 

Ben

Organization:
Keywords:
Fernando Garcia's picture
Offline
Last seen: 4 months 6 days ago
Joined: 05/18/2011
Posts: 199

Hi,

To create a basic DLL you will need the following flags:

WIN32_LEAN_AND_MEAN;WIN32;_WINDOWS;_USRDLL;NDDS_DLL_VARIABLE;RTI_WIN32;RTI_ENDIAN_LITTLE;

You will also have to add the include directories $(NDDSHOME)\include and $(NDDSHOME)\include\ndds.

 

Best,
Fernando.

Offline
Last seen: 11 years 9 months ago
Joined: 03/27/2012
Posts: 3

Thanks for the prompt reply but I Still get my unresolved symbols.

 

 

>BallTopic.obj : error LNK2001: unresolved external symbol __imp_DDS_LOG_MEMORY_ALLOCATED_dd

1>BallTopic.obj : error LNK2001: unresolved external symbol __imp_DDS_LOG_SET_FAILURE_s

1>BallTopicPlugin.obj : error LNK2019: unresolved external symbol RTIOsapiHeap_freeMemoryInternal referenced in function BallPluginSupport_create_data_ex

1>BallTopicPlugin.obj : error LNK2019: unresolved external symbol RTIOsapiHeap_reallocateMemoryInternal referenced in function BallPluginSupport_create_data_ex

 

 

I link with nddscpp.lib;nddsc.lib;nddscore.lib.

 

What am I missing?

 

Ben

jorge's picture
Offline
Last seen: 11 years 11 months ago
Joined: 02/07/2011
Posts: 1

Hi Ben,

Do you get the error when using the library that you created or while creating that new library?

 

Check that you have the RTI libraries in your PATH (in Windows), or in the LD_LIBRARY_PATH (in Linux)

 

Jorge

Offline
Last seen: 11 years 9 months ago
Joined: 03/27/2012
Posts: 3

 

Hi Jorge,

 

It was a link time and i figured it out. It was as 64bits vs 32bits problem.

 

Thank you for your time.

 

Ben

 

Offline
Last seen: 9 years 3 months ago
Joined: 12/15/2014
Posts: 2

Hi all,

Would it be possible to post what the issue with x64 vs 32-bit Windows? I am trying to get a basic 64-bit service up on VS2013, and getting linker resolution errors no matter what I put as pre-processor defines.

Thanks,
Tim

Here are the defines from the VS2013 Project file:

  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
...
      <PreprocessorDefinitions>NDDS_DLL_VARIABLE;RTI_WIN32;WIN32;_DEBUG;_WINDOWS;_USRDLL;TESTDLL3_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <AdditionalIncludeDirectories>$(NDDSHOME)\include;$(NDDSHOME)\include\ndds;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    </ClCompile>
    <Link>
...
      <AdditionalDependencies>nddscpp.lib;nddsc.lib;nddscore.lib;netapi32.lib;advapi32.lib;user32.lib;WS2_32.lib;;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories>$(NDDSHOME)\lib\x64Win64VS2013;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
    </Link>
  </ItemDefinitionGroup>

 

rip
rip's picture
Offline
Last seen: 18 hours 13 min ago
Joined: 04/06/2012
Posts: 324

VS2013 or VS2013 Express?

Offline
Last seen: 9 years 3 months ago
Joined: 12/15/2014
Posts: 2

Express

rip
rip's picture
Offline
Last seen: 18 hours 13 min ago
Joined: 04/06/2012
Posts: 324

The VS - express editions have traditionally been 32bit only.  I know they changed that recently, but you may need to download 64bit libraries from Microsoft before you can create 64bit applications.

jwillemsen's picture
Offline
Last seen: 2 years 10 months ago
Joined: 09/24/2013
Posts: 55

Using Visual Studio 2015 RC I do get the following warnings, I do use RTI_WIN32, NDDS_DLL_VARIABLE, and NDDS_USER_DLL_EXPORT as defines when compiling the generated code

ndds.5.1.0\include\ndds/dds_cpp/dds_cpp_publication.h(323): warning C4275: non dll-interface class 'DDSDomainEntity' used as base for dll-interface class 'DDSDataWriter'
ndds.5.1.0\include\ndds/dds_cpp/dds_cpp_infrastructure.h(284): note: see declaration of 'DDSDomainEntity'
ndds.5.1.0\include\ndds/dds_cpp/dds_cpp_publication.h(323): note: see declaration of 'DDSDataWriter'
ndds.5.1.0\include\ndds/dds_cpp/dds_cpp_subscription.h(356): warning C4275: non dll-interface class 'DDSDomainEntity' used as base for dll-interface class 'DDSDataReader'
ndds.5.1.0\include\ndds/dds_cpp/dds_cpp_infrastructure.h(284): note: see declaration of 'DDSDomainEntity'
ndds.5.1.0\include\ndds/dds_cpp/dds_cpp_subscription.h(356): note: see declaration of 'DDSDataReader'

Reureu's picture
Offline
Last seen: 6 years 3 months ago
Joined: 11/28/2017
Posts: 4

Hi,

Did you ever get a reply about these C4275 warnings in VS 2015?

I am using VS 2017 with Connext Pro 5.3.0.1, and I am facing a similar problem, with a slightly different warning code.

I am trying to export the types rtiddsgen has created for me.

  • Without NDDS_USER_DLL_EXPORT, no type is exported.
  • With the NDDS_USER_DLL_EXPORT precompilation directive, the types are exported, but the following warnings pops up when compiling:
    C:\Program Files\rti_connext_dds-5.3.0\include\ndds\hpp\dds/core/String.hpp(42): warning C4251: 'std::_String_alloc<std::_String_base_types<_Elem,_Alloc>>::_Mypair': class 'std::_Compressed_pair<std::allocator,std::_String_val<std::_Simple_types<_Ty>>,true>' needs to have dll-interface to be used by clients of class 'std::_String_alloc<std::_String_base_types<_Elem,_Alloc>>'1> with1> [1> _Elem=char,1> _Alloc=std::allocator1> ]1> and1> [1> _Ty=char1> ]1> and1> [1> _Elem=char,1> _Alloc=std::allocator1> ]

Any suggestion would be greatly appreciated!

Thanks!

Reureu

jwillemsen's picture
Offline
Last seen: 2 years 10 months ago
Joined: 09/24/2013
Posts: 55

Yes, the C4275 we reported have been fixed by RTI in their latest release. I haven't seen the ones you reported.

Reureu's picture
Offline
Last seen: 6 years 3 months ago
Joined: 11/28/2017
Posts: 4

Thank you jwillemsen!

Do you still have only RTI_WIN32, NDDS_DLL_VARIABLE, and NDDS_USER_DLL_EXPORT as "custom" precompilation directives?

Mine are:

  • NDDS_DLL_VARIABLE
  • WIN32_LEAN_AND_MEAN
  • WIN32
  • RTI_WIN32
  • NDEBUG
  • _CONSOLE
  • _SCL_SECURE_NO_WARNINGS
  • NDDS_USER_DLL_EXPORT

Maybe it's related to VS 2017?

 

jwillemsen's picture
Offline
Last seen: 2 years 10 months ago
Joined: 09/24/2013
Posts: 55

We are using

  • WIN32
  • _WINDOWS
  • _CRT_NONSTDC_NO_WARNINGS
  • _AMD64_
  • _WIN64
  • _CRT_SECURE_NO_WARNINGS
  • _CRT_SECURE_NO_DEPRECATE
  • _CRT_NONSTDC_NO_DEPRECATE
  • _WINSOCK_DEPRECATED_NO_WARNINGS
  • RTI_WIN32
  • NDDS_DLL_VARIABLE