|
From: <mod...@li...> - 2004-11-08 08:04:19
|
It wouldn't let me send with the .zip files. So if are interested, send
me an email and I'll send the .zip to you directly.
=20
Tommy
________________________________
From: Tommy Hui=20
Sent: Sunday, November 07, 2004 11:46 PM
To: 'mod...@li...'
Subject: RE: [Mod-pubsub-developer] Runtime problem when using .Net
connector
Hi everyone!
=20
Okay, I've gotten it to work finally with VC71. Apparently, due to a bug
with VC71, the DotNet layer doesn't work. It ultimately leads to a
coding area that has been vauge with MC++.
=20
There's a workaround fix to the code in the DotNet directory. Note that
you should only do this if you are compiling with VC71. The code changes
I'm about to show you do not have the proper #ifdefs around it to ensure
only VC71 pick up the changes. If you ever want to build with any of the
older compilers, it will likely fail. There are two affected files:
=20
MessageM.h
MessageM.cpp
=20
The problem is the unmanaged C++ stl type is part of the managed class.
Apparently, VC71 no longer likes to generate the proper metadata for any
unmanaged types. Therefore, the change is to make the iterator
implementation completely hidden from the managed class. Change the type
of m_Iter from=20
=20
::Message::Container::const_iterator* m_Iter;
=20
to
=20
void* m_Iter;
=20
The next step is that in the MessageEnumerator methods that use m_Iter,
we need to cast it to back to the const_iterator:
=20
Object* MessageEnumerator::get_Current()
{
if (m_Iter =3D=3D 0)
throw new InvalidOperationException();
=20
::Message::Container::const_iterator* temp =3D
(::Message::Container::const_iterator*)m_Iter;
=20
if ((*temp) =3D=3D m_Message->GetImpl()->GetContainer().end())
throw new InvalidOperationException();
=20
MessageEntry* me =3D new MessageEntry();
me->Field =3D new String((*(*temp)).first.c_str());
me->Value =3D new String((*(*temp)).second.c_str());
=20
return me;
}
=20
void MessageEnumerator::Reset()
{
if (m_Iter)
{
::Message::Container::const_iterator* temp =3D
(::Message::Container::const_iterator*)m_Iter;
delete temp;
m_Iter =3D 0;
}
}
=20
bool MessageEnumerator::MoveNext()
{
if (m_Message->GetImpl()->GetContainer().empty())
return false;
=20
if (m_Iter =3D=3D 0)
{
m_Iter =3D new ::Message::Container::const_iterator();
::Message::Container::const_iterator* temp =3D
(::Message::Container::const_iterator*)m_Iter;
*temp =3D m_Message->GetImpl()->GetContainer().begin();
return true;
}
=20
::Message::Container::const_iterator* temp =3D
(::Message::Container::const_iterator*)m_Iter;
=20
(*temp)++;
=20
bool retVal =3D (*temp) !=3D =
m_Message->GetImpl()->GetContainer().end();
=20
m_Iter =3D temp;
=20
return retVal;
}
=20
For your convenience, I've attached the two affected files in the
MessageM.zip.
=20
Finally, when you build the sample files, you will need to do the
following to make it work with VC71:
=20
1. Convert the project over to VC71. You will need to make the files
writable.
2. Move the using LibKNDotNet statement from outside of the namespace to
inside the namespace to remove any ambiguity.
3. Remove the reference to LibKNDotNet assembly and change it to
LibKNDotNet71 or LibKNDotNet71D depending on whether it is debug or not.
=20
Tommy
________________________________
From: mod...@li...
[mailto:mod...@li...]=20
Sent: Sunday, November 07, 2004 10:39 PM
To: mod...@li...
Subject: RE: [Mod-pubsub-developer] Runtime problem when using .Net
connector
Hi Rohit,
=20
Yes, I've been able to reproduce the problem. It appears the problem is
related to something VC7.1 is doing differently from VC7.0. I'm trying
to track down the issue and will let you know when I find something.
=20
Tommy
________________________________
From: mod...@li...
[mailto:mod...@li...]=20
Sent: Sunday, November 07, 2004 8:56 PM
To: 'mod...@li...'
Subject: [Mod-pubsub-developer] Runtime problem when using .Net
connector
Hi,=20
I am facing a problem when I used the .Net connector (client) in
the given sample dotnet code. (It is supposed to work with Visual Studio
7.1 and later, I am using Visual Studio 2003).The python server is
running. I am able to successfully run the javascript examples. The
given .Net code (which subscribes to events for some stock quote web
service) compiles properly. But when I start it up , it throws an
exception saying could not load type const_iterator. The references path
etc. are correct. What could be the problem. I understand that the C++
connector code has been wrapped in managed C++ code and is then invoked
from the C# client. Any help would be appreciated.
Regards,=20
Rohit Khetan.=20
This message is free from Virus - IMSS
=09
|