Hi Karel,

Sometimes the short questions are the best. Your question prompted me to look at mico/demo/obv, which I believe has examples of what I need to do. Thanks!



On Tue, 29 Nov 2005 14:42:36 -0800, Karel Gardas <[EMAIL PROTECTED]> wrote:


Short question: have you registered your valuetype factory on both sides?

Cheers,
Karel
--
Karel Gardas                  [EMAIL PROTECTED]
ObjectSecurity Ltd.           http://www.objectsecurity.com
---
Need experienced, fast, reliable technical MICO support?
     ---> http://www.objectsecurity.com/commsup.html  <---
---

On Tue, 29 Nov 2005, Bob Gunion wrote:

This may have more to do with my limited understanding of valuetypes than with mico, but I've been banging my head against this for a couple of days and need some more expert input (read: I'm almost out of aspirin). I ran this test on three development environments, all with the same results:
- micoo 2.3.12RC2, gcc 3.4.4, RedHat Linux 9
- mico 2.3.7, gcc 3.2.1, RedHat Linux 7
- mico 2.3.11, VC++7, Win2k

I've attached my test code, but here's a summary of what's happening:
Using this idl:

module test {
 valuetype testvalue {
   public long ival;
   long foo();
 };

 interface testinterface {
   testvalue getValue();
   any getAny();
   long dofoo();
 };

};

The server side is straightforward. I'm trying to do this on the client side:

(Get a CORBA::Object_var obj..)

 testinterface_var intfc = testinterface::_narrow(obj);
 if (CORBA::is_nil(intfc)) {
   cerr << argv[0] << ": can't narrow testinterface" << endl;
   return -1;
 }

 CORBA::Any_var any = intfc->getAny();
 testvalue_impl * pCValue = new testvalue_impl(999);
 test::testvalue_var tv = pCValue;
 if (any >>= tv) {                       <<<<<<<<<<<<<<<<<<<<< ERROR!
   printf("%s:  Extracted the any.  ival = %d, foo = %d\n",
          argv[0],
          pCValue->ival(),
          pCValue->foo());
 } else {
   cerr << argv[0] << ": Failed to extract the any" << endl;
   return -1;
 }
 return 0;


When I try to extract the testvalue from the any, I get a CORBA::Marshal exception. I've tried using DynAny to parse the any, and that works but is very clumsy. So I know the correct information is in the any but I can't extract it.

Using gdb, I got a backtrace of the error. Everything looks fine up to this point in the c++ code generated from idl:

::CORBA::Boolean _Marshaller_testvalue::demarshal( ::CORBA::DataDecoder &dc, StaticValueType v ) const
{
 ::CORBA::ValueBase* vb = NULL;
if (!::CORBA::ValueBase::_demarshal (dc, vb, "IDL:testvalue:1.0")) { <<<<<< ERROR!
   return FALSE;
 }
 ::CORBA::remove_ref (*(_MICO_T *)v);
 *(_MICO_T *)v = ::testvalue::_downcast (vb);
 if (vb && !*(_MICO_T *)v) {
   ::CORBA::remove_ref (vb);
   return FALSE;
 }
 return TRUE;
}

The CORBA::ValueBase::_demarshal function takes a const std::string reference as the third parameter. But according to gdb, the third parameter becomes a reference to a null pointer. Is gdb lying to me, or is something else happening here? I admit I have minimal experience with gdb, but I also tried creating my own test function like this:

long strtestfn(const std::string& str) {
 printf("In strtestfn: %s\n", str.c_str());
 return 42;
}

int main(int argc, char * argv[]) {
 long result = strtestfn("Hello");
}

.. and this worked without problems.  So I'm stumped.  Please help!

(Note: Here's the big picture: I'd like to deliver valuetypes using the event service, so I could have all the data passed like a struct, and in rare cases also have functions I could call to get more info from the server. Maybe I could accomplish the same thing by having an object reference in my struct, and only call methods on that object in those rare cases. Thoughts?)

Thanks, and keep up the great work on mico!



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
_______________________________________________
Mico-devel mailing list
[email protected]
http://www.mico.org/mailman/listinfo/mico-devel

Reply via email to