0

I have a need to compile an existing message library generated using ZeroC's ICE with c++ clr.

I've been at this for a while and I'm having no luck.

I have a very simple .ice message file defined. Upon generating the cpp and h files for this, I try to compile them into a .dll. My slice2cpp command line args are

C:\Program Files (x86)\ZeroC\Ice-3.5.1\bin\slice2cpp.exe --depend --dll-export=ENABLE_DLL -I"C:\Program Files (x86)\ZeroC\Ice-3.5.1\slice" -I".\.." --underscore  "E:\test\platform\platform\testMessage.ice"

This generates me a testMessage.cpp and testMessage.h files. Upon attempting to compile these, I get the error:

Error   7   error LNK2028: unresolved token (0A00098D) "class IceUtil::Shared * __cdecl IceInternal::upCast(class IceInternal::ObjectFactoryManager *)" (?upCast@IceInternal@@$$FYAPEAVShared@IceUtil@@PEAVObjectFactoryManager@1@@Z) referenced in function "public: __cdecl IceInternal::Handle<class IceInternal::ObjectFactoryManager>::Handle<class IceInternal::ObjectFactoryManager>(class IceInternal::Handle<class IceInternal::ObjectFactoryManager> const &)" (??0?$Handle@VObjectFactoryManager@IceInternal@@@IceInternal@@$$FQEAA@AEBV01@@Z)   E:\test\platform\platform\testMessage.obj   platform

As per usual with Ice, I have to link the Iced.lib and IceUtild.lib files. I compile with no pre compiled headers and /clr option on (not pure clr or safe) using VS2013. The body of the testMessage.ice file is very simple.

#ifndef _MESSAGE_ICE_
#define _MESSAGE_ICE_

module messaging {

class Message
{
    string clientId;
    string origin;
    string destination;
    string messageType;
    string suffix;
};

sequence<Message> MessageSeq;

class NonQueuedMsg extends messaging::Message {};

};

#endif

Compiling without the CLR option on results in success.

I imagine this is all caused by my lack of familiarity with c++ clr. Any help would be appreciated.

Alan Stokes
  • 18,815
  • 3
  • 45
  • 64
sbrett
  • 606
  • 4
  • 20

2 Answers2

2

I had the same problem after the migration of my projects to vs 2013.

The project c++ with ice compile fine but the project c++/cli with ice don't links.

I fixed linking problem in ObjectFactoryManagerF.h :

#ifdef __cplusplus_cli
IceUtil::Shared* upCast(ObjectFactoryManager* p) { return (IceUtil::Shared*) p; };
#else
IceUtil::Shared* upCast(ObjectFactoryManager* );
#endif
0

I stopped trying to make C++/CLI and ICE-generated code work together after I read on their forum here that they didn't support it. What I've done.. I've made native static library on the client's side where I had C++/CLI. Static library fully encapsulated all communication stuff and was referenced from C++/CLI part. As a result I've got a Mixed (C++/CLR) Recommended Rules assembly. It works fine plus I've got easier portable application.

Syb3rian
  • 171
  • 2
  • 14