Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-25-2004
level level is offline
Registered User
 
 
Join Date: Feb 2004
Location: China
Posts: 71
Difference of ice code in dll or exe?

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?
Reply With Quote
  #2 (permalink)  
Old 03-25-2004
level level is offline
Registered User
 
 
Join Date: Feb 2004
Location: China
Posts: 71
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?
Reply With Quote
  #3 (permalink)  
Old 03-25-2004
mes's Avatar
mes mes is online now
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
What error do you get?

Are you sure that you are compiling the main program and the DLL with the same compiler options?

- Mark
Reply With Quote
  #4 (permalink)  
Old 03-26-2004
level level is offline
Registered User
 
 
Join Date: Feb 2004
Location: China
Posts: 71
the same code (the client side ) could not get the same result in dll and in main exe.
And in the dll ,the vc2003 debuger throw the error ,that the error could not be catch by ice.
Could you write the example that the client program call the function (all the ice code ).
Reply With Quote
  #5 (permalink)  
Old 04-01-2004
level level is offline
Registered User
 
 
Join Date: Feb 2004
Location: China
Posts: 71
Talking

Sorry ,
I have find the cause.It isnot ice 's error.
My dll (debug) is not link iced.lib , .

I'm sorry for wasted your time.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
What's the difference between generatecs.exe and slice2cs.exe? bartley Help Center 1 08-09-2006 08:37 PM
Difference between Console and Service Application? lkw Help Center 7 06-24-2006 09:51 PM
code contrib asmirnov Comments 1 05-31-2006 09:34 AM
difference between proxies from class and from interface kovacm Help Center 3 05-29-2005 05:57 PM
performance difference zigzag Bug Reports 3 05-23-2005 10:42 PM


All times are GMT -4. The time now is 09:16 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.