Home Help Center

problem about Hello world

I compile "Hello world" program.
complie is ok,
run Sever and client OK too.
printer->printString("Hello World!");
change code printer->printString("Hello World! This");
run client
error
Debug Assertion Failed!
Program: d:\temp\temp\printer\Debug\printer.exe
File:dbgfel.cpp
Line:52

Expression:_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

why


Thanks

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    I'm afraid you must provide a lot more information in order for us being able to help you. Of course changing the string doesn't change the functionality of the demo in any way, so something else must have changed.
  • codecode Member
    I only change a String.This is a input parameter on service side
    I use vc7.1

    service.cpp:

    #include <Ice/Ice.h>
    #include <Print.h>
    using namespace std;
    class PrinterI : public Printer {
    public:
    virtual void printString(const string & s,const Ice::Current &);
    };
    void
    PrinterI::
    printString(const string & s, const Ice::Current &)
    {
    cout << s << endl;
    }
    int
    main(int argc, char* argv[])
    {
    int status = 0;
    Ice::CommunicatorPtr ic;
    try {
    ic = Ice::initialize(argc, argv);
    Ice::ObjectAdapterPtr adapter= ic->createObjectAdapterWithEndpoints("SimplePrinterAdapter", "default -p 10000");
    Ice::ObjectPtr object = new PrinterI;
    adapter->add(object,Ice::stringToIdentity("SimplePrinter"));
    adapter->activate();
    ic->waitForShutdown();
    } catch (const Ice::Exception & e) {
    cerr << e << endl;
    status = 1;
    } catch (const char * msg) {
    cerr << msg << endl;
    status = 1;
    }
    if (ic)
    ic->destroy();
    return status;
    }


    client.cpp:

    #include <Ice/Ice.h>
    #include <Print.h>
    using namespace std;
    int
    main(int argc, char * argv[])
    {
    int status = 0;
    Ice::CommunicatorPtr ic;
    try {
    ic = Ice::initialize(argc, argv);
    Ice::ObjectPrx base = ic->stringToProxy("SimplePrinter:default -p 10000");
    PrinterPrx printer = PrinterPrx::checkedCast(base);
    if (!printer)
    throw "Invalid proxy";
    printer->printString("Hello my good World!");
    } catch (const Ice::Exception & ex) {
    cerr << ex << endl;
    status = 1;
    } catch (const char * msg) {
    cerr << msg << endl;
    status = 1;
    }
    if (ic)
    ic->destroy();
    return status;
    }

    print.ice:

    interface Printer
    {
    void printString(string s);
    };


    error at :dbgdel.cpp
    pHead = pHdr(pUserData);
    /* verify block type */
    _ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Sorry, I don't know what the problem is. Changing the string does not matter to the demo. Try changing the string back to the original value, and I'm sure you get the same failure. Most likely, it is a problem with how you compiled the client. For example, you might have mixed debug with nondebug libraries, or multi-threaded with non-multithreaded. The stack trace supports this, as it doesn't even contain anything about Ice.
  • codecode Member
    Thank you very much
    I mixed debug with nondebug libraries.
    Now is OK.
Sign In or Register to comment.