en:docs:tk:som:interg

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:docs:tk:som:interg [2024/12/22 17:45] prokusheven:docs:tk:som:interg [2024/12/24 16:37] (current) prokushev
Line 169: Line 169:
  
         echo_client = ORB_string_to_object(SOMD_ORBObject, &ev, ior);         echo_client = ORB_string_to_object(SOMD_ORBObject, &ev, ior);
-        somPrintf("testec=%d", (long)echo_client); 
  abort_if_exception(&ev, "bind failed");  abort_if_exception(&ev, "bind failed");
  
Line 206: Line 205:
 </code> </code>
  
-As you see, here just downgraded code to CORBA 1.1 C Language mapping from CORBA 2.x C Language mapping. ORB initialization and finalization replaced by DSOM initialization and finalization. And, this is matter, EchoNew() call added to create Echo class to make it known to DSOM. Now you can compile it and all mostly ready.+As you see, here just downgraded code to CORBA 1.1 C Language mapping from CORBA 2.x C Language mapping. ORB initialization and finalization replaced by DSOM initialization and finalization. And, this is matter, EchoNew() call added to create Echo class to make it known to DSOM. Also add SOMSTAR to object variables. Now you can compile it and all mostly ready.
  
 Now you have SOM client with stub class implementation and interface registered in interface repository. You are ready now. Now you have SOM client with stub class implementation and interface registered in interface repository. You are ready now.
  
-====== ORBit2 ======+====== ORBit2 2.14.19 ======
  
 somFree was tested with the latest available ORBit2 implementation (version 2.14.19). ORBit2 shipped as packages on various operational systems, including various Linux distributions, and Cygwin package on Windows system. So, install ORBit2 first using your package manager (add step-by-step guide for Cygwin at least). somFree was tested with the latest available ORBit2 implementation (version 2.14.19). ORBit2 shipped as packages on various operational systems, including various Linux distributions, and Cygwin package on Windows system. So, install ORBit2 first using your package manager (add step-by-step guide for Cygwin at least).
Line 268: Line 267:
  
 Now your server is ready. Execute echo-server and you will have console with waiting echo. To make client know about Echo server copy generated echo.ior to client directory. Now your server is ready. Execute echo-server and you will have console with waiting echo. To make client know about Echo server copy generated echo.ior to client directory.
 +
 +====== omniORB 4.3.2 ======
 +
 +Another ORB for testing is a omniORB 4.3.2. Unlike ORBit2 it still maintained and new versions published at 2024 year. So, it was also chosen for testing. It comes in source code so you need to build it. Build process described well, works with cygwin and VS2022. Only required fix is in mk\python.mk is to set line as bellow:
 +
 +<code>
 +PYVERSION := $(shell $(PYTHON) -c 'import sys; sys.stdout.write(".".join(sys.version.split()[0].split(".")[:2]))')
 +</code>
 +
 +We have tested it with Python 2.7 but newer versions also must work good. omniORB also contains echo example, but slightly differ. echoString method returns string back. So, echo.idl was replaced to one from ORBit2 and server skeleton was changed (add sources here).
 +
 +Same somFree client was executed and all works just fine. IOR file not stored in echo.ior but output to console. So IOR was replaced by this one. somFree client sucessfully connected and works as expected. omniORB is a C++ ORB.
  
 ====== Executing somFree client ====== ====== Executing somFree client ======
Line 318: Line 329:
  
 (omniORB and TAX also must be tested as most available OSS. May be some other ORBs?) (omniORB and TAX also must be tested as most available OSS. May be some other ORBs?)
 +
 +====== C Language Mapping differences ======
 +
 +somFree uses CORBA 1.1 C Language Mappings. Most of CORBA compatible ORBs uses later specifications, at least at CORBA 2.0 level. Some changes was introduced from CORBA 1.1 to CORBA 2.0:
 +
 +  - All CORBA base types now prefixed by CORBA_ prefix
 +  - All items from module CORBA prefixed by CORBA_ prefix (as well as other items from other modules also must be prefixed)
 +  - Environment and Context moved to last function arguments
 +
 +So, to simplify migration from CORBA 2.0+ mapping to CORBA 1.1 mapping follow include file (not finished yes, contains only some conversions) can be used:
 +
 +<code c>
 +/*
 +  CORBA 1.2+ compatibility layer
 + */
 +
 +#ifndef CORBA_Environment
 +#define CORBA_Environment Environment
 +#endif
 +
 +#define CORBA_exception_init(ev) SOM_InitEnvironment(ev)
 +
 +#ifndef CORBA_ORB
 +#define CORBA_ORB ORB
 +#endif
 +
 +#ifndef CORBA_ORB_init
 +CORBA_ORB SOMSTAR CORBA_ORB_init ( int * argc, char ** argv, char * orb_id, CORBA_Environment * env);
 +
 +CORBA_ORB SOMSTAR CORBA_ORB_init ( int * argc, char ** argv, char * orb_id, CORBA_Environment * env)
 +{
 +  SOMD_Init(env);
 +  return SOMD_ORBObject;
 +}
 +#endif
 +
 +#ifndef CORBA_ORB_destroy
 +#define CORBA_ORB_destroy(orb, ev) SOMD_Uninit(ev); SOM_UninitEnvironment(ev);
 +#endif
 +
 +#ifndef CORBA_OBJECT_NIL
 +#define CORBA_OBJECT_NIL NULL
 +#endif
 +
 +#ifndef CORBA_NO_EXCEPTION
 +#define CORBA_NO_EXCEPTION NO_EXCEPTION
 +#endif
 +
 +#ifndef CORBA_exception_id
 +#define CORBA_exception_id(ev) somExceptionId(ev)
 +#endif
 +
 +#ifndef CORBA_exception_free
 +#define CORBA_exception_free(ev) somExceptionFree(ev)
 +#endif
 +
 +#ifndef CORBA_ORB_string_to_object
 +#define CORBA_ORB_string_to_object ORB_string_to_object
 +#endif
 +
 +#ifndef CORBA_Object_release
 +#define CORBA_Object_release SOMDObject_release
 +#endif
 +
 +#ifndef CORBA_double
 +#define CORBA_double double
 +#endif
 +
 +#ifndef CORBA_Object
 +#define CORBA_Object SOMObject
 +#endif
 +
 +</code>
 +
 +If you convert from CORBA 1.2 mapping such approach mostly enough. But for CORBA 2.0+ mapping you also need to change methods arguments order. For example:
 +
 +<code c>
 +echo_client = CORBA_ORB_string_to_object(orb, ior, ev);
 +</code>
 +
 +must be changed to
 +
 +<code c>
 +echo_client = CORBA_ORB_string_to_object(orb, ev, ior);
 +</code>
 +