FooPlugin_get_serialized_sample_max_size call causing segfault

3 posts / 0 new
Last post
Offline
Last seen: 8 months 4 weeks ago
Joined: 09/07/2018
Posts: 10
FooPlugin_get_serialized_sample_max_size call causing segfault

 

I have used FooPlugin_get_serialized_sample_max_size() with Connext 5.x with no issues. But now trying to move to Connext 7.x and those same calls are causing segmentation faults.

I've always called it with null parameters: FooPlugin_get_serialized_sample_max_size(0,0,0,0) and it returned the max size of the type Foo (in v5.x)

But that doesn't work on Connext v7.x.  Does it now need an actual PRESTypePluginEndpointData endpoint_data value?  And how can I get it using C++98 ?

I don't understand why it needs endpoint_data since the call is specific for type Foo and the max size should be static at compile time.

 

Offline
Last seen: 3 weeks 5 days ago
Joined: 02/20/2020
Posts: 6

Hi Chris,

You should be using DDS_TypeCode::cdr_serialized_sample_max_size. Here you have an example code snippet:

 DDS_TypeCode * tc = ShapeType_get_typecode();
 DDS_ExceptionCode_t ex_code;
 unsigned long max_serialized_size = tc->cdr_serialized_sample_max_size(
 DDS_AUTO_DATA_REPRESENTATION,
 ex_code
 );
 std::cout << max_serialized_size << std::endl;

Let me know if it works for you.

Offline
Last seen: 8 months 4 weeks ago
Joined: 09/07/2018
Posts: 10

 

Sure did!  Thanks!

This did the trick nicely:

uint get_sample_max_size(DDS_TypeCode *tc)
{
   DDS_ExceptionCode_t ex_code;
   return tc->cdr_serialized_sample_max_size(ex_code);
}

 std::cout << get_sample_max_size(Foo_get_typecode()) << std::endl;