Home Help Center

IceUtil problem??

peterpeter Member Peter JaxyOrganization: Reihnisch Westfälisch technische HochschuleProject: Integrative Production Technologie ✭✭
If I compile my Server and Client with my Makefiles, there aren't errors.
But if I run there is a problem:
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
Aborted

what does this means?
How can I solve it?

Comments

  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    In streamClient.cpp, you call setDataString, passing argc and argv (of type int and char*). The call is made in a loop, so the same values of argc and argv are passed in each iteration.

    In setDataString, you call Ice::initialize, passing argc and argv. What is actually passed here is a reference to argc (int& argc).

    Ice::Initialize modifies the argument vector and changes argc to 1 because the command line contains --Ice.Config=config.client.

    The change to argc is not reflected in the code that calls setDataString because setDataString expects an int, not an int&. (setDataString passes a reference to its local copy of argc that sits on the stack as the parameter to the call, not the argc that is passed to main.)

    The net result is that, on the second iteration, you pass an argc of 2 to setDataString, but an argv that contains only one element instead of the expected two. The exception is caused by Ice derefencing the terminating null pointer in argv[1].

    So, you have to make sure that you pass a correct argc/argv to Ice::Initialize.

    Cheers,

    Michi.
Sign In or Register to comment.