How to call C API in code?

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

Hello,

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:

https://community.rti.com/rti-doc/510/ndds.5.1.0/doc/html/api_c/group__DDSSubscriberExampleModule.html#DDSSubscriberExampleModule_subscriber_setup

https://community.rti.com/static/documentation/connext-dds/5.2.0/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/index.htm#UsersManual/AccessingData_Samples_ReadTake.htm

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?

 

 

 

 

Keywords:
irwin's picture
Offline
Last seen: 4 years 4 months ago
Joined: 08/14/2010
Posts: 42

Kay,
   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

                                 Irwin