Archived

This forum has been archived. Please start a new discussion on GitHub.

C++ IceStorm Publisher works in Debug mode but not in Release Mode

I am trying to publish to an IceStorm Service from MATLAB using the Mex Interface. Things work when I compile the Mex file in Debug (in Visual Studio 2010) but not in Release Mode. When I run it in Release mode I get the following error
Exception when trying to initialize ice.
Instance.cpp:427: Ice::IdentityParseException:
error while parsing identity `invalid identity name `hÜÂ

Just for reference this is the code I use to initialize
	try {
		string topicManagerStr = "DemoIceStorm/TopicManager:tcp -h 127.0.0.1 -p 10203";
		m_communicator = Ice::initialize();
		Ice::ObjectPrx proxyBase = m_communicator->stringToProxy(topicManagerStr);
		mexPrintf("Created Connection\n");
		TopicManagerPrx manager = TopicManagerPrx::checkedCast(proxyBase);
		TopicPrx hbTopic = manager->retrieve(slice::hats::hatsHbTopicName);
		mexPrintf("Got heartbeat topic\n");
		m_heartBeatProxy = HeartBeatPrx::uncheckedCast(hbTopic->getPublisher()->ice_oneway());
		TopicPrx tmTopic = manager->retrieve(slice::hats::hatsTlmTopicName);
		mexPrintf("Got tlm topic\n");
		m_telemetryProxy = TelemetryPrx::uncheckedCast(tmTopic->getPublisher()->ice_oneway());
		string message = "Initialized connection to : ";
		message.append(topicManagerStr);
		message.append("\n");
		mexPrintf(message.c_str());
	} catch (exception& e) {
		ostringstream ost;
		ost << "Exception when trying to initialize ice. " << endl
			<<  e.what() << endl;
		mexErrMsgTxt(ost.str().c_str());
	}

Comments

  • xdm
    xdm La Coruña, Spain
    Hi Sriram,

    Are you linking with Ice release libraries when building in release mode?

    For release builds:

    Ice.lib, IceUtil.lib, IceStorm.lib

    And for debug builds:

    Iced.lib, IceUtild.lib, IceStormd.lib

    And for other libs you link with is the same, you must not mix release/debug libs, this can cause strange errors as you will end with two versions of C runtime one for debug one for release.
  • The strange thing is I am linking with the release libs Ice.lib IceUtil.lib etc. even when I am building in Debug mode. So I would expect things to break in Debug mode but no... Also if I try to link Iced.lib etc when building Debug I get an application cannot start error (which crashes MATLAB too).
  • bernard
    bernard Jupiter, FL
    For the Ice libraries, "debug" means built with /MDd, while "release" means built with /MD.

    See /MD, /MT, /LD (Use Run-Time Library).

    Your own Ice-based application should use the same option as the Ice libraries you link with. Can you confirm which option you use?

    Best regards,
    Bernard
  • Yes I am using MultiThreaded Dll /MD for Release and MultiThreaded Debug DLL /MDd for Debug.
  • bernard
    bernard Jupiter, FL
    You should also double check that you are using the correct DLLs. The Visual Studio 2010 DLLs are in the bin\vc100 directory. You should not use the DLLs in the main bin directory (built with Visual Studio 2008).

    Best regards,
    Bernard
  • How can I check which version of the dlls is being used and how can I change it?
  • xdm
    xdm La Coruña, Spain
    That is done in your environment PATH configuration.

    See Using the Windows Binary Distribution - Ice 3.4 - ZeroC
  • Yup that solved it. Thanks a lot.