Home Help Center

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

nsriramnsriram Member Sriram NarasimhanOrganization: UCSCProject: MATLAB Simulation
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

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    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.
  • nsriramnsriram Member Sriram NarasimhanOrganization: UCSCProject: MATLAB Simulation
    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).
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    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
  • nsriramnsriram Member Sriram NarasimhanOrganization: UCSCProject: MATLAB Simulation
    Yes I am using MultiThreaded Dll /MD for Release and MultiThreaded Debug DLL /MDd for Debug.
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    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
  • nsriramnsriram Member Sriram NarasimhanOrganization: UCSCProject: MATLAB Simulation
    How can I check which version of the dlls is being used and how can I change it?
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    That is done in your environment PATH configuration.

    See Using the Windows Binary Distribution - Ice 3.4 - ZeroC
  • nsriramnsriram Member Sriram NarasimhanOrganization: UCSCProject: MATLAB Simulation
    Yup that solved it. Thanks a lot.
Sign In or Register to comment.