adlink-ist / idlpp-cxx Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Hello everyone,
I am having troubles working with a vector of strings. I have the following IDL file:
module Msg
{
struct StringSeq {
long id;
sequence<string<10>, 5> names;
};
#pragma keylist StringSeq id
};
which should allow me to work with a vector with at most 5 strings of maximal 10 characters.
Now, I would like to write a message using cyclonedds-cxx. To this end, I just took the helloworld example, I changed the IDL file with mine above and replaced the content of the file publisher.cpp with:
#include <iostream>
#include "dds/dds.hpp"
#include "StringSeq_DCPS.hpp"
using namespace org::eclipse::cyclonedds;
int main() {
dds::domain::DomainParticipant participant(domain::default_id());
dds::topic::Topic<Msg::StringSeq> topic(participant, "StringSeq");
dds::pub::Publisher publisher(participant);
dds::pub::DataWriter<Msg::StringSeq> writer(publisher, topic);
std::vector<std::string> stringVector{"Name1", "Name2", "Name3"};
Msg::StringSeq msg(18, stringVector);
writer.write(msg);
std::cout << "Messagge written." << std::endl;
return EXIT_SUCCESS;
}
However, the execution results in an error when the function __Msg_StringSeq__copyIn in the file StringSeqSplDcps.cpp tries to "strncpy" the first entry of stringVector in an invalid location, since the components of dest0 have not been initialized properly in the previous line of code:
dest0 = (length0 == 0) ? 0 : (char * *)dds_alloc(length0 * sizeof(char *));
Is this problem caused because a corresponding for-loop is missing in the function idl_seqAllocBuffer in the file idl_genLiteISOCxxCopyin.c?
Thank you in advance, any help would be appreciated.
Best regards,
Ettore Vidotto
Hi,
while compiling idlpp-cxx with the latest clang stable release i encountered the following linker errors:
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/set.c.o:(.bss+0xc): multiple definition of `expr_sharp'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/eval.c.o:(.bss+0xc): first defined here
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/sharp.c.o:(.bss+0x0): multiple definition of `ifstack'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/at.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/sharp.c.o:(.bss+0x8): multiple definition of `n_skipped_ifs'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/at.c.o:(.bss+0x8): first defined here
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/undef.c.o:(.bss+0x0): multiple definition of `ifstack'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/at.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/undef.c.o:(.bss+0x8): multiple definition of `n_skipped_ifs'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/at.c.o:(.bss+0x8): first defined here
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/while.c.o:(.bss+0x0): multiple definition of `ifstack'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/at.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/while.c.o:(.bss+0x8): multiple definition of `n_skipped_ifs'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/at.c.o:(.bss+0x8): first defined here
Happens on idlpp-cxx-1.0.0 and master branch. With clang-10 everything compiles. I guess this happens due some global declarations in header files.
Affected global declarations in the following files:
idlpp/ppresources/ospli/src/cpp/code/expr.h - int expr_sharp;
idlpp/ppresources/ospli/src/cpp/code/if.h - IF *ifstack;
idlpp/ppresources/ospli/src/cpp/code/if.h - int n_skipped_ifs;
idlpp/ppresources/ospli/src/tools/idlpp/code/idl_genIdlHelper.h - os_iter idl_idlScopeKeyList;
idlpp/ppresources/ospli/src/tools/idlpp/code/idl_genIdlHelper.h - os_iter idl_idlScopeStreamsList;
I guess these variables need to be declared, but i'm not sure about the implications in the overall system.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.