Personal tools
You are here: Home Forum Extension of the platform Use of CORBA_CLIENT_HEADER macro to make a Salome client

Use of CORBA_CLIENT_HEADER macro to make a Salome client

Up to Extension of the platform

Use of CORBA_CLIENT_HEADER macro to make a Salome client

Posted by Thomas PEDOT at November 05. 2012

Hello,

I try to make a salome client as I explained here : http://www.salome-platform.org/forum/forum_10/173044974

I want to port a Linux program to windows program to see if I am able to make my client (WIN32) communicating with Salome (Server on Ubuntu). I succeed to compile and use it on Linux side but I still fail on Windows side.

 

To make my Salome/CORBA client (to use MEDCoupling CORBA API), I use CORBA_CLIENT_HEADER macro like this :

1 - I generate CALCULATOR_Gen.hh on linux side :

2 - I import it on windows

3 - I include CALCULATOR_Gen thanks to CORBA_CLIENT_HEADER macro :

#include CORBA_CLIENT_HEADER(CALCULATOR_Gen)

where CALCULATOR_Gen.hh is generated by salome.

4 - Use methods in my programs
 
but it fails to compile (see build log attached).
 
Here is CALCULATOR_Gen (I don't know how to attach to files) :
 
---------------------------------------------------------------------------------------------------------------------------
 
// This file is generated by omniidl (C++ backend)- omniORB_4_1. Do not edit.
#ifndef __CALCULATOR__Gen_hh__
#define __CALCULATOR__Gen_hh__
 
#ifndef __CORBA_H_EXTERNAL_GUARD__
#include <omniORB4/CORBA.h>
#endif
 
#ifndef  USE_stub_in_nt_dll
# define USE_stub_in_nt_dll_NOT_DEFINED_CALCULATOR__Gen
#endif
#ifndef  USE_core_stub_in_nt_dll
# define USE_core_stub_in_nt_dll_NOT_DEFINED_CALCULATOR__Gen
#endif
#ifndef  USE_dyn_stub_in_nt_dll
# define USE_dyn_stub_in_nt_dll_NOT_DEFINED_CALCULATOR__Gen
#endif
 
 
 
#ifndef __SALOME__GenericObj_hh_EXTERNAL_GUARD__
#define __SALOME__GenericObj_hh_EXTERNAL_GUARD__
#include <SALOME_GenericObj.hh>
#endif
#ifndef __SALOME__Exception_hh_EXTERNAL_GUARD__
#define __SALOME__Exception_hh_EXTERNAL_GUARD__
#include <SALOME_Exception.hh>
#endif
#ifndef __SALOMEDS_hh_EXTERNAL_GUARD__
#define __SALOMEDS_hh_EXTERNAL_GUARD__
#include <SALOMEDS.hh>
#endif
#ifndef __SALOME__PyNode_hh_EXTERNAL_GUARD__
#define __SALOME__PyNode_hh_EXTERNAL_GUARD__
#include <SALOME_PyNode.hh>
#endif
#ifndef __SALOME__Component_hh_EXTERNAL_GUARD__
#define __SALOME__Component_hh_EXTERNAL_GUARD__
#include <SALOME_Component.hh>
#endif
#ifndef __SALOME__Types_hh_EXTERNAL_GUARD__
#define __SALOME__Types_hh_EXTERNAL_GUARD__
#include <SALOME_Types.hh>
#endif
#ifndef __MEDCouplingCorbaServant_hh_EXTERNAL_GUARD__
#define __MEDCouplingCorbaServant_hh_EXTERNAL_GUARD__
#include <MEDCouplingCorbaServant.hh>
#endif
 
 
 
#ifdef USE_stub_in_nt_dll
# ifndef USE_core_stub_in_nt_dll
#  define USE_core_stub_in_nt_dll
# endif
# ifndef USE_dyn_stub_in_nt_dll
#  define USE_dyn_stub_in_nt_dll
# endif
#endif
 
#ifdef _core_attr
# error "A local CPP macro _core_attr has already been defined."
#else
# ifdef  USE_core_stub_in_nt_dll
#  define _core_attr _OMNIORB_NTDLL_IMPORT
# else
#  define _core_attr
# endif
#endif
 
#ifdef _dyn_attr
# error "A local CPP macro _dyn_attr has already been defined."
#else
# ifdef  USE_dyn_stub_in_nt_dll
#  define _dyn_attr _OMNIORB_NTDLL_IMPORT
# else
#  define _dyn_attr
# endif
#endif
 
 
 
 
 
_CORBA_MODULE CALCULATOR_ORB
 
_CORBA_MODULE_BEG
 
  _CORBA_MODULE_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_ErrorCode;
 
  typedef ::CORBA::Long ErrorCode;
  typedef ::CORBA::Long_out ErrorCode_out;
 
  _CORBA_MODULE_VARINT const ::CORBA::Long NO_ERROR _init_in_decl_( = 0 );
 
  _CORBA_MODULE_VARINT const ::CORBA::Long NOT_COMPATIBLE _init_in_decl_( = 1 );
 
  _CORBA_MODULE_VARINT const ::CORBA::Long EXCEPTION_RAISED _init_in_decl_( = 2 );
 
  _CORBA_MODULE_VARINT const ::CORBA::Long INVALID_FIELD _init_in_decl_( = 3 );
 
#ifndef __CALCULATOR__ORB_mCALCULATOR__Gen__
#define __CALCULATOR__ORB_mCALCULATOR__Gen__
 
  class CALCULATOR_Gen;
  class _objref_CALCULATOR_Gen;
  class _impl_CALCULATOR_Gen;
  
  typedef _objref_CALCULATOR_Gen* CALCULATOR_Gen_ptr;
  typedef CALCULATOR_Gen_ptr CALCULATOR_GenRef;
 
  class CALCULATOR_Gen_Helper {
  public:
    typedef CALCULATOR_Gen_ptr _ptr_type;
 
    static _ptr_type _nil();
    static _CORBA_Boolean is_nil(_ptr_type);
    static void release(_ptr_type);
    static void duplicate(_ptr_type);
    static void marshalObjRef(_ptr_type, cdrStream&;);
    static _ptr_type unmarshalObjRef(cdrStream&;);
  };
 
  typedef _CORBA_ObjRef_Var<_objref_CALCULATOR_Gen, CALCULATOR_Gen_Helper> CALCULATOR_Gen_var;
  typedef _CORBA_ObjRef_OUT_arg<_objref_CALCULATOR_Gen,CALCULATOR_Gen_Helper > CALCULATOR_Gen_out;
 
#endif
 
  // interface CALCULATOR_Gen
  class CALCULATOR_Gen {
  public:
    // Declarations for this interface type.
    typedef CALCULATOR_Gen_ptr _ptr_type;
    typedef CALCULATOR_Gen_var _var_type;
 
    static _ptr_type _duplicate(_ptr_type);
    static _ptr_type _narrow(::CORBA::Object_ptr);
    static _ptr_type _unchecked_narrow(::CORBA::Object_ptr);
    
    static _ptr_type _nil();
 
    static inline void _marshalObjRef(_ptr_type, cdrStream&;);
 
    static inline _ptr_type _unmarshalObjRef(cdrStream& s) {
      omniObjRef* o = omniObjRef::_unMarshal(_PD_repoId,s);
      if (o)
        return (_ptr_type) o->_ptrToObjRef(_PD_repoId);
      else
        return _nil();
    }
 
    static _core_attr const char* _PD_repoId;
 
    // Other IDL defined within this scope.
    
  };
 
  class _objref_CALCULATOR_Gen :
    public virtual Engines::_objref_EngineComponent
  {
  public:
    ::CORBA::Double convergenceCriteria(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field);
    SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr applyLin(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1, ::CORBA::Double a1, ::CORBA::Double a2);
    SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr add(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1, ::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field2);
    ::CORBA::Double norm2(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field);
    ::CORBA::Double normL2(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field);
    ::CORBA::Double normL1(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field);
    ::CORBA::Double normMax(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field);
    void printField(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field);
    void cloneField(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field, ::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_out clone1, ::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_out clone2, ::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_out clone3, ::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_out clone4);
    ::CORBA::Boolean isDone();
    ErrorCode getErrorCode();
 
    inline _objref_CALCULATOR_Gen()  { _PR_setobj(0); }  // nil
    _objref_CALCULATOR_Gen(omniIOR*, omniIdentity*);
 
  protected:
    virtual ~_objref_CALCULATOR_Gen();
 
    
  private:
    virtual void* _ptrToObjRef(const char*);
 
    _objref_CALCULATOR_Gen(const _objref_CALCULATOR_Gen&;);
    _objref_CALCULATOR_Gen& operator = (const _objref_CALCULATOR_Gen&;);
    // not implemented
 
    friend class CALCULATOR_Gen;
  };
 
  class _pof_CALCULATOR_Gen : public _OMNI_NS(proxyObjectFactory) {
  public:
    inline _pof_CALCULATOR_Gen() : _OMNI_NS(proxyObjectFactory)(CALCULATOR_Gen::_PD_repoId) {}
    virtual ~_pof_CALCULATOR_Gen();
 
    virtual omniObjRef* newObjRef(omniIOR*,omniIdentity*);
    virtual _CORBA_Boolean is_a(const char*) const;
  };
 
  class _impl_CALCULATOR_Gen :
    public virtual Engines::_impl_EngineComponent
  {
  public:
    virtual ~_impl_CALCULATOR_Gen();
 
    virtual ::CORBA::Double convergenceCriteria(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field) = 0;
    virtual SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr applyLin(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1, ::CORBA::Double a1, ::CORBA::Double a2) = 0;
    virtual SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr add(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field1, ::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field2) = 0;
    virtual ::CORBA::Double norm2(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field) = 0;
    virtual ::CORBA::Double normL2(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field) = 0;
    virtual ::CORBA::Double normL1(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field) = 0;
    virtual ::CORBA::Double normMax(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field) = 0;
    virtual void printField(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field) = 0;
    virtual void cloneField(::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr field, ::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_out clone1, ::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_out clone2, ::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_out clone3, ::SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_out clone4) = 0;
    virtual ::CORBA::Boolean isDone() = 0;
    virtual ErrorCode getErrorCode() = 0;
    
  public:  // Really protected, workaround for xlC
    virtual _CORBA_Boolean _dispatch(omniCallHandle&;);
 
  private:
    virtual void* _ptrToInterface(const char*);
    virtual const char* _mostDerivedRepoId();
    
  };
 
 
  _CORBA_MODULE_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_CALCULATOR_Gen;
 
_CORBA_MODULE_END
 
 
 
_CORBA_MODULE POA_CALCULATOR_ORB
_CORBA_MODULE_BEG
 
  class CALCULATOR_Gen :
    public virtual CALCULATOR_ORB::_impl_CALCULATOR_Gen,
    public virtual POA_Engines::EngineComponent
  {
  public:
    virtual ~CALCULATOR_Gen();
 
    inline ::CALCULATOR_ORB::CALCULATOR_Gen_ptr _this() {
      return (::CALCULATOR_ORB::CALCULATOR_Gen_ptr) _do_this(::CALCULATOR_ORB::CALCULATOR_Gen::_PD_repoId);
    }
  };
 
_CORBA_MODULE_END
 
 
 
_CORBA_MODULE OBV_CALCULATOR_ORB
_CORBA_MODULE_BEG
 
_CORBA_MODULE_END
 
 
 
 
 
#undef _core_attr
#undef _dyn_attr
 
void operator<<=(::CORBA::Any& _a, CALCULATOR_ORB::CALCULATOR_Gen_ptr _s);
void operator<<=(::CORBA::Any& _a, CALCULATOR_ORB::CALCULATOR_Gen_ptr* _s);
_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, CALCULATOR_ORB::CALCULATOR_Gen_ptr& _s);
 
 
 
inline void
CALCULATOR_ORB::CALCULATOR_Gen::_marshalObjRef(::CALCULATOR_ORB::CALCULATOR_Gen_ptr obj, cdrStream& s) {
  omniObjRef::_marshal(obj->_PR_getobj(),s);
}
 
 
 
 
#ifdef   USE_stub_in_nt_dll_NOT_DEFINED_CALCULATOR__Gen
# undef  USE_stub_in_nt_dll
# undef  USE_stub_in_nt_dll_NOT_DEFINED_CALCULATOR__Gen
#endif
#ifdef   USE_core_stub_in_nt_dll_NOT_DEFINED_CALCULATOR__Gen
# undef  USE_core_stub_in_nt_dll
# undef  USE_core_stub_in_nt_dll_NOT_DEFINED_CALCULATOR__Gen
#endif
#ifdef   USE_dyn_stub_in_nt_dll_NOT_DEFINED_CALCULATOR__Gen
# undef  USE_dyn_stub_in_nt_dll
# undef  USE_dyn_stub_in_nt_dll_NOT_DEFINED_CALCULATOR__Gen
#endif
 
#endif  // __CALCULATOR__Gen_hh__
----------------------------------------------------------------------------------------------------------------------------------------------------------
 
Does anyone have an idea on this ?
Thanks in advance.
 
Thomas
Attachments

Re: Use of CORBA_CLIENT_HEADER macro to make a Salome client

Posted by Saint Michael at November 06. 2012

I don't know how to attach two files

I see two options:

1) put them in an archive file
2) attach the second file to another post

:)

St.Michael

Re: Use of CORBA_CLIENT_HEADER macro to make a Salome client

Posted by Thomas PEDOT at November 06. 2012

Previously Saint Michael wrote:

I don't know how to attach two files

I see two options:

1) put them in an archive file
2) attach the second file to another post

:)

St.Michael

 
Thanks for your simple suggestions St.Michael.
 
I attached an archive with 3 files :

 

- CALCULATOR_Gen.hh
- ParaMED_Test.cpp
- BuildLog.html
 
For instance there is no CORBA instruction in main. It fails at CORBA_CLIENT_HEADER inclusion. 
I may have forget to predefine variables for the preprocessing.
 
  _CORBA_MODULE_VARINT is defined NULL
NOT_COMPATIBLE, EXCEPTION_RAISED, INVALID_FIELD are not set.
 
Attachments

Re: Use of CORBA_CLIENT_HEADER macro to make a Salome client

Posted by Thomas PEDOT at November 06. 2012

I may have undestand what was happening.

In line :

_CORBA_MODULE_VARINT const ::CORBA::Long OL _init_in_decl_( = 0 );

NO_ERROR has to be an identifier which was not the case in my configuration. There was some conflict with the variable defined in WinError.h.

So I put the right definition for this variables ("0L") and it compiles.

Powered by Ploneboard
Document Actions