Git Product home page Git Product logo

idlpp-cxx's People

Contributors

e-hndrks avatar eboasson avatar thijssassen avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

idlpp-cxx's Issues

Vector of string is not handled correctly

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

[Bug] Linker Error on Clang 13 Compiler

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.