[omniORB] Passing char array from omniORB to javaidl Please help!!

Duncan Grisby dgrisby@uk.research.att.com
Fri, 14 Dec 2001 16:18:40 +0000


On Friday 14 December, "Christian Dyczek" wrote:

> This is a multi-part message in MIME format.

Please do not send HTML mail to the omniORB mailing list.

> For my project i need to transfer a char array from the client (java
> idl) to the server (omniORB). This message should have 121 elements.
> Therefore I created following idl file:

[...]
> interface Echo {
>   typedef sequence<char,121> msg;

That is not an array of 121 elements. It's a sequence with _up to_ 121
elements. If you always want exactly 121 elements, use

  typedef char msg[121];

If what you want is really a string with up to 121 characters, you
should use

  typedef string<121> msg;

> The problem is hat i do not know how I can write into these
> sequenz(array)
> I think that this line from the xxxSK.cpp is important form e but i am
> not able to understand it :
> Echo::msg* testConnection(const Echo::msg& testConnection);
>  
> In the echo example this line looks like that:
> char* testConnection(const char* msg);

You need to understand the way different IDL types map to C++ types.
Sequences are treated totally differently to strings.

I strongly recommend that you get "Advanced CORBA Programming with
C++" by Henning and Vinoksi. For help with your immediate problem, I
advise that you read the example chapter, about the C++ mapping, from

  http://cseng.aw.com/book/0,3828,0201379279,00.html

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --