How to call C API in code?

2 posts / 0 new
Last post
Last seen: 4 years 4 weeks ago
Joined: 08/11/2019
Posts: 28
How to call C API in code?


I have a basic question : How to call C API in code? 

I want to try to " Access received data via a subscriber " and I find these two links:

and I try to put it's sample code into Helloworld, but it didn't work,

So how to call C API correctly? what are the steps?

STEP1:use rtiddsgen genarate code

STEP2 : find RTI Connext C API 

DDS_ReturnCode_t FooDataReader_read_w_condition ( FooDataReader * self,
struct FooSeq * received_data,
struct DDS_SampleInfoSeq * info_seq,
DDS_Long max_samples,
DDS_ReadCondition * condition

STEP3 : copy to subscriber

--> it didn't work

Is there any sample code I can learn?





irwin's picture
Last seen: 3 years 10 months ago
Joined: 08/14/2010
Posts: 42

   I would start with the getting started guide. I do not know exactly what RTI DDS revision that
you are useing, but the documentation refererence you showed that I presume that it is 5.1.0.
Therefore in your system I would refere to <your Installation>F:\RTI\ndds.5.1.0\doc\pdf\RTI_CoreLibrariesAndUtilities_GettingStarted.pdf

   I suggest that you create a C example as follows:
rtiddsgen -Language C -ppDisable -example <Your Platform> HelloWorld.idl

  The code generated in particular HelloWorld_publisher.c and HelloWorld_subscriber.c provides examples on using our C API