Archived
This forum has been archived. Please start a new discussion on GitHub.
Difference of ice code in dll or exe?
level
in Help Center
The same (client side) ice code ,in dll (call by main exe as export function ) or in exe (inline).
The code in main exe can run fine.
But the same code in dll ,then be called by main exe ,the vc2003 debuger throw the error?
My question is when I put the (client side) ice code in dll ,and call by the main exe program, what should I do?
The code in main exe can run fine.
But the same code in dll ,then be called by main exe ,the vc2003 debuger throw the error?
My question is when I put the (client side) ice code in dll ,and call by the main exe program, what should I do?
0
Comments
-
The DLL part:
void __declspec( dllexport ) getowners(::worm::OwnerSeq &os)
{
........................
communicator = Ice::initialize(argc, 0);
Ice::ObjectPrx obj = communicator->stringToProxy("localhost:tcp -p 888888:udp -p 888888
mproxy=0;
mproxy = localhost::UserHostPrx::uncheckedCast(obj);
mproxy->GetServerManager(lockkey,sm);
...
sm=::worm::ServerManagerPrx::uncheckedCast(sm);
sm->GetAllOwner(os);
........................
}
The Main part:
void mmdlg::OnBnClickedButton1()
{
::worm::OwnerSeq os;
getowners(os);//this function in dll part;
....
::worm::OwnerPrx own1;
try
{
own1=::worm::OwnerPrx::checkedCast(os[0]);
own1->ice_ping();//error !!!!!!!!!!!!why??
}
catch(const IceUtil::Exception& ex)
{
std::ostringstream ostr;
ostr << ex;
std::string s = ostr.str();
AfxMessageBox(CString(s.c_str()), MB_OK|MB_ICONEXCLAMATION);
}
::worm::StringSeq desc;
desc.push_back("HostName");
::worm::StringSeq info;
try
{
own1->PullString(desc,info);//ice: PullString (stringseq desc,stringseq info);
//stringseq==> sequence<string> stringseq;
}
catch(...)
{
}
AfxMessageBox(_T(info[0].c_str()));
....
}
If I paste the code in dll to main exe (in function OnBnClickedButton1),the code run fine. why?0
