Skip to content

Commit

Permalink
Fix for issue #269
Browse files Browse the repository at this point in the history
Moved definitions of the static type/topic information to implementation
file

Signed-off-by: Martijn Reicher <[email protected]>
  • Loading branch information
reicheratwork authored and eboasson committed May 13, 2022
1 parent 7d97c9f commit bf851d8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/idlcxx/src/traits.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ emit_traits(
"}\n\n";
static const char *type_info_hdr1 =
"#ifdef DDSCXX_HAS_TYPE_DISCOVERY\n"
"template<> constexpr const unsigned int TopicTraits<%1$s>::type_map_blob_sz = %2$u;\n"
"template<> constexpr const unsigned int TopicTraits<%1$s>::type_info_blob_sz = %3$u;\n"
"template<> constexpr const unsigned char TopicTraits<%1$s>::type_map_blob[] = {\n";
"template<> const unsigned int TopicTraits<%1$s>::type_map_blob_sz = %2$u;\n"
"template<> const unsigned int TopicTraits<%1$s>::type_info_blob_sz = %3$u;\n"
"template<> const unsigned char TopicTraits<%1$s>::type_map_blob[] = {\n";
static const char *type_info_hdr2 =
" };\n"
"template<> constexpr const unsigned char TopicTraits<%1$s>::type_info_blob[] = {\n";
"template<> const unsigned char TopicTraits<%1$s>::type_info_blob[] = {\n";

if (IDL_PRINTA(&name, get_cpp11_fully_scoped_name, node, gen) < 0 ||
idl_fprintf(gen->header.handle, fmt, name, name+2) < 0)
Expand Down Expand Up @@ -151,11 +151,11 @@ emit_traits(
idl_typeinfo_typemap_t blobs;
if (gen->config && gen->config->generate_typeinfo_typemap && gen->config->generate_type_info) {
if (gen->config->generate_typeinfo_typemap(pstate, (const idl_node_t*)node, &blobs) ||
idl_fprintf(gen->header.handle, type_info_hdr1, name, blobs.typemap_size, blobs.typeinfo_size) < 0 ||
write_blob(gen->header.handle, blobs.typemap, blobs.typemap_size) ||
idl_fprintf(gen->header.handle, type_info_hdr2, name) < 0 ||
write_blob(gen->header.handle, blobs.typeinfo, blobs.typeinfo_size) ||
idl_fprintf(gen->header.handle, " };\n#endif //DDSCXX_HAS_TYPE_DISCOVERY\n\n") < 0)
idl_fprintf(gen->impl.handle, type_info_hdr1, name, blobs.typemap_size, blobs.typeinfo_size) < 0 ||
write_blob(gen->impl.handle, blobs.typemap, blobs.typemap_size) ||
idl_fprintf(gen->impl.handle, type_info_hdr2, name) < 0 ||
write_blob(gen->impl.handle, blobs.typeinfo, blobs.typeinfo_size) ||
idl_fprintf(gen->impl.handle, " };\n#endif //DDSCXX_HAS_TYPE_DISCOVERY\n\n") < 0)
ret = IDL_RETCODE_NO_MEMORY;

//cleanup typeinfo_typemap blobs
Expand Down

0 comments on commit bf851d8

Please sign in to comment.