[Ace-users] Re: [tao-users] Can you set -ORBEndpoint for multiple ORBs in command line

Matthew Gillen mgillen at bbn.com
Thu Sep 27 10:12:28 CDT 2007

Phil Mesnier wrote:
> Hi,
> Chun Tat David Chu wrote:
>>     ACE VERSION: 5.6.1
> Thanks for using the PRF.
>>     I am pretty sure the answer is no base on the information I read on 
>> TAO Developer's Guide, but figure it doesn't hurt to ask.  :-)
> The simple answer is "no" because if you just pass argc, argv to the 
> first ORB, it will consume both endpoint arguments, leaving nothing for 
> the second.
>>     Currently I've 2 ORBs in my server.  Each ORB listen on a different 
>> port, and in my code I explicity create a "-ORBEndpoint" argument for 
>> each ORB and pass it to the CORBA::ORB_init() function.  This is working 
>> fine, but I'm wondering if there's a way I can specify my "-ORBEndpoint" 
>> for my 2 ORBs through command line in my server start-up script.
> You could do it with application-specific arguments though, preprocess 
> the argv list to transform one argument into -ORBEndpoint before passing 
> it to ORB 1, then transform the other argument into -ORBEndpoint before 
> passing it to ORB 2.
> This is generally true for all -ORB* command line arguments, they are 
> destructively consumed by ORB_init. So if you want to pass any command 
> line arg to multiple ORBs, you need to keep a local copy of the arg 
> before calling ORB_init.

Although if want to live dangerously, you might note exactly how the arguments
are "consumed": you'll notice that you can just save the value of argc, and
use the same argv again and again.  The argv parameters are reordered by
ORB_init, and argc is decremented to make it look like they "consumed"
arguments are gone (that's why argc is passed by reference!).

Of course this technique is based on an implementation detail of TAO, not on a
spec of any sort, so nothing is guaranteed about this technique w.r.t.
portability to other ORBs, or future versions of TAO, etc.

But it's a neat trick if you're just writing some throw-away test app.


More information about the Ace-users mailing list