Discussion:
[omniORB] Any option to omniidl to generate __declspec() for Windows?
Tuyen Chau
2006-10-19 03:33:34 UTC
Permalink
Is there any option to omniidl to generate __declspec(dllexport) for
each of the symbol name so that C++ stubs can be packaged as a DLL on
Windows? Orbix does it by default, eg.

#ifdef _MSC_VER
#ifdef IT_EXPORT_DLL_Echo
#define IT_DECLSPEC_Echo __declspec(dllexport)
#else
#ifdef IT_IMPORT_DLL_Echo
#define IT_DECLSPEC_Echo __declspec(dllimport)
#else
#define IT_DECLSPEC_Echo
#endif
#endif
#else
#define IT_DECLSPEC_Echo
#endif

class IT_DECLSPEC_Echo Echo : ...
{
public:
...
}

Thanks,
Tuyen
Stefan Näwe
2006-10-19 12:56:54 UTC
Permalink
Post by Tuyen Chau
Is there any option to omniidl to generate __declspec(dllexport) for
each of the symbol name so that C++ stubs can be packaged as a DLL on
Windows? Orbix does it by default, eg.
#ifdef _MSC_VER
#ifdef IT_EXPORT_DLL_Echo
#define IT_DECLSPEC_Echo __declspec(dllexport)
#else
#ifdef IT_IMPORT_DLL_Echo
#define IT_DECLSPEC_Echo __declspec(dllimport)
#else
#define IT_DECLSPEC_Echo
#endif
#endif
#else
#define IT_DECLSPEC_Echo
#endif
class IT_DECLSPEC_Echo Echo : ...
{
...
}
Use the docs, Luke!

http://omniorb.sourceforge.net/omni40/omniORB/omniORB012.html

Stefan
--
----------------------------------------------------------------------
Stefan Naewe ATLAS Elektronik GmbH
Dept.: NUS T4
phone: +49-(0)421-457-1378 Sebaldsbruecker Heerstr. 235
fax: +49-(0)421-457-3913 28305 Bremen
Serguei Kolos
2006-10-19 22:50:48 UTC
Permalink
Hi

I'm using omniORB 4.0.7 on Linux and it seems that I get into trouble with
the Object ID manipulation. The problem is:

- I'm using my own POA with the System ID policy
- when I activate the first object in my process the Object key which
is created by the
omniOrbPOA::create_new_key function (poa.cc:2578) looks like "poa
id" + "object id" where
"object id" is the 4 bytes of the pd_oidIndex variable which
initially is set to 0.

_CORBA_ULong idx = pd_oidIndex;
...
memcpy(k + pd_poaIdSize, (const CORBA::Octet*) &idx,
SYS_ASSIGNED_ID_SIZE);

As a result the last 4 bytes of the Object key are 0 !!!!

- If I call the PortableServer::ObjectId_to_string function
(portableserver.cc:401) for this
object ID it throws the BAD_PARAM exception because the Object ID
contains zeros.

The code looks like:

for( int i = 0; i < len; i++ )
if( (char) (s[i] = id[i]) == '\0' ) {
_CORBA_String_helper::free(s);
OMNIORB_THROW(BAD_PARAM,BAD_PARAM_InvalidObjectId,
CORBA::COMPLETED_NO);
}

If I don't misunderstood something could somebody suggest me how to fix
the issue.

Cheers,
Sergei
Duncan Grisby
2006-10-23 21:57:50 UTC
Permalink
Post by Serguei Kolos
I'm using omniORB 4.0.7 on Linux and it seems that I get into trouble with
- I'm using my own POA with the System ID policy
[...]
Post by Serguei Kolos
- If I call the PortableServer::ObjectId_to_string function
(portableserver.cc:401) for this
object ID it throws the BAD_PARAM exception because the Object ID
contains zeros.
ObjectId_to_string is purely a helper function for the case that you
have user assigned ids that are strings. It isn't intended to be used
for system ids.

What are you trying to do that requires conversion of system ids into
strings?

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Serguei Kolos
2006-10-23 22:03:36 UTC
Permalink
Post by Duncan Grisby
Post by Serguei Kolos
- If I call the PortableServer::ObjectId_to_string function
(portableserver.cc:401) for this
object ID it throws the BAD_PARAM exception because the Object ID
contains zeros.
ObjectId_to_string is purely a helper function for the case that you
have user assigned ids that are strings. It isn't intended to be used
for system ids.
What are you trying to do that requires conversion of system ids into
strings?
I'm just using them as part of my debug printout which helps me to trace
the lifetime
of various objects. What else can I use to uniquely identify CORBA
objects in the
debug statements?

Cheers,
Sergei
Duncan Grisby
2006-10-23 22:15:37 UTC
Permalink
Post by Serguei Kolos
I'm just using them as part of my debug printout which helps me to
trace the lifetime of various objects. What else can I use to uniquely
identify CORBA objects in the debug statements?
The simple thing is to write a little function that converts the
sequence of octets into a hex string.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Loading...