Packaging IDL for reuse in C# projects

1 post / 0 new
Offline
Last seen: 1 month 1 week ago
Joined: 02/20/2020
Posts: 1
Packaging IDL for reuse in C# projects

I'm looking to split common IDL and specific IDL for reusing purposes in a C# environment. I've created a Position.idl file and a Car.idl file in separate projects. I've used rtiddsgen to generate the type files for position and build a dll (based on the example solution).

I've added the Position.idl and the DLLs to a NuGet package. In the car projects, I included a reference to the NuGet package for Position and used rtiddsgen with a -I to the position.idl file of the package. So far everything works as expected. One of the errors I encounter is related to the Position_get_typecode(), which is apparently not exported. Looking at the generated Position.h and .cpp, I see #ifndef NDDS_STANDALONE_TYPE at several locations. The manual for rtiddsgen does not really specify why this would be the case. It only specifies how you can enable this (https://community.rti.com/static/documentation/connext-dds/6.0.1/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/Content/UsersManual/UsingGenTypeswithoutStandalo.htm), which I think I don't want. 

The second error is related to the include directives that rtiddsgen in the car files (i.e. #include "Position.h" and/or #include "PositionPlugin.h"), because these headers are not required as the DLL will supply the required information. For now, I'm removing them by hand, but it would be nice if this was an option. 

As a sidenote, it seems relevant to note that my NuGet package for Position contains both Position, PositionPlugin and PositionSupport.

I also tried to forward declare the Position in Car.idl, but rtiddsgen does not allow incomplete types with: 

 

ERROR com.rti.ndds.nddsgen.Main Car.idl line 11:2 member has incomplete type
ERROR com.rti.ndds.nddsgen.Main Fail: java.lang.Exception: The file couldn't be parsed and the rawTree wasn't generated

So, generally how can I split up my IDL over multiple projects? More specifically, how can I either exclude the usage of Position_get_typecode() or enable it in my resulting DLL, together with not generating the #includes?

As an example:

Position.idl:

struct Position {
long x;
long y;
};  

Car.idl:

#include "Position.idl"

struct Car {
@key long id;
Position p;
};     

Later something like this might appear. Truck.idl:

#include "Position.idl"

struct Truck {
@key long id;
Position p;
long load;
};