[omniORB] How to convert long integer in python to unsigned long in CORBA

Vito Bica vitob5 at cox.net
Thu Oct 27 08:49:54 BST 2005


I have defined the following value in python:

x = 0x80000000

Python seems to interpret this as an unsigned value, and therefore makes it 
a long integer (2147483648, one more than the maximum positive value 
allowable for a signed 32 bit int).

I try to pass it as a value in a CORBA method that takes an argument of 
CORBA type "Unsigned Long". Python balks, saying that it cannot convert the 
python Long Integer type to an integer. What I really want is to get that 
value passed as-is as an argument to that CORBA method. Is there anything I 
can do in Python or with some omnipy fucntion that will map that 32 bit 
value into the CORBA unsigned long argument?

I realize I could represent the value as a signed decimal value rather than 
a hex value, but for my application hex makes much more sense.

TIA,
Vito




More information about the omniORB-list mailing list