[omniORB] type Any

JHJE (Jan Holst Jensen) jhje@novonordisk.com
Thu Jul 11 13:11:01 2002


Hi Luke and Christophe.

Assigning a string to a Delphi Variant can give you both ANSI and UNICODE
strings depending on whether you end up with a Variant of type varString or
varOleStr/varStrArg. However, quoting the Object Pascal Language Guide:

"The varString type code is private to Delphi. Variants containing a
varString value should never be passed to a non-Delphi function. Delphi's
Automation support automatically converts varString variants to varOleStr
variants before passing them as parameters to external functions."

so Luke is indeed correct, since I assume this conversion takes place as
soon as you pass the Variant to the orb (?). According to the Borland docs,
this feature of variants holds true for both Delphi 5 and 6.

Without knowledge of the IDL in question, the only solution that comes to
mind is modifying the marshalling routine for the method call, intercepting
String-anys and putting them on the parameter stream directly. Sounds hairy
though... but I would not know if it is as bad as it sounds :-).

Cheers,

-- Jan Holst Jensen, Denmark

Original message:
=================
Date: Thu, 11 Jul 2002 17:07:56 +1000
From: Luke Deller <ldeller@xplantechnology.com>
To: Christophe de Vienne <cdevienne@alphacent.com>
Cc: OmniOrb List <omniorb-list@realvnc.com>
Subject: Re: [omniORB] type Any

Hi Christophe,

Since nobody has yet jumped in with an answer, let me throw in an idea...

 > The problem occur when we have a string in one the any. If the client is
 > omniORB or JavaORB, everything works perfectly. But if its visibroker, we
 > cannot extract the string from a Any.

I seem to recall that when you assign a string to a Delphi "Variant" type,
it is implicitly converted to a wide string.  Is this true?

If so, then your "any" probably contains a CORBA "wstring" rather than a
"string", which would explain the behaviour that you see.  Unfortunately
OmniORB3 does not support wide strings (but they are supported in OmniORB4).
   Maybe you can find a way to tweak VisiBroker to send a "string" instead.

Regards,
Luke.