#include "SALOME_NamingService.hxx"
#include "Utils_SINGLETON.hxx"
#include "OpUtil.hxx"
+#include "PythonCppUtils.hxx"
#include "utilities.h"
#include <time.h>
#include <sys/time.h>
#include "Container_init_python.hxx"
// L'appel au registry SALOME ne se fait que pour le process 0
-Engines_MPIContainer_i::Engines_MPIContainer_i(CORBA::ORB_ptr orb,
+Engines_MPIContainer_i::Engines_MPIContainer_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
char * containerName,
- int argc, char *argv[])
+ int argc, char *argv[])
: Engines_Container_i(orb,poa,containerName,argc,argv,nullptr,false)
{
BCastIOR(_orb,pobj,true);
}
-Engines_MPIContainer_i::Engines_MPIContainer_i()
+Engines_MPIContainer_i::Engines_MPIContainer_i()
: Engines_Container_i()
{
}
#else
std::string impl_name = std::string ("lib") + aCompName + std::string("Engine.so");
#endif
-
- _numInstanceMutex.lock(); // lock to be alone
+
+ _numInstanceMutex.lock(); // lock to be alone
// (see decInstanceCnt, finalize_removal))
if (_toRemove_map[impl_name]) _toRemove_map.erase(impl_name);
if (_library_map[impl_name])
_numInstanceMutex.unlock();
return true;
}
-
+
void* handle;
handle = dlopen( impl_name.c_str() , RTLD_LAZY | RTLD_GLOBAL ) ;
if ( handle )
}
else
{
+ PyObject *pyCont = nullptr;
+ std::string ret;
{
AutoGIL agil;
PyObject *mainmod = PyImport_AddModule((char *)"__main__");
PyObject *globals = PyModule_GetDict(mainmod);
- PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
+ pyCont = PyDict_GetItemString(globals, "pyCont");
PyObject *result = PyObject_CallMethod(pyCont,
(char*)"import_component",
(char*)"s",componentName);
- std::string ret= PyUnicode_AsUTF8(result);
+ ret= PyUnicode_AsUTF8(result);
SCRUTE(ret);
}
-
+
if (ret=="") // import possible: Python component
{
_library_map[aCompName] = (void *)pyCont; // any non O value OK
std::string component_registerName =
_containerName + "/" + instanceName;
+ std::string iors;
{
AutoGIL agil;
PyObject *mainmod = PyImport_AddModule((char*)"__main__");
const char *ior;
const char *error;
PyArg_ParseTuple(result,"ss", &ior, &error);
- std::string iors = ior;
+ iors = ior;
SCRUTE(iors);
}
-
+
CORBA::Object_var obj = _orb->string_to_object(iors.c_str());
iobject = Engines::EngineComponent::_narrow( obj ) ;
pobj = Engines::MPIObject::_narrow(obj) ;
return iobject._retn();
}
-
+
//--- try C++
#ifdef __APPLE__
typedef PortableServer::ObjectId * (*MPIFACTORY_FUNCTION)
(CORBA::ORB_ptr,
- PortableServer::POA_ptr,
- PortableServer::ObjectId *,
- const char *,
+ PortableServer::POA_ptr,
+ PortableServer::ObjectId *,
+ const char *,
const char *) ;
dlerror();
const char *,
const char *) =
(PortableServer::ObjectId * (*) (CORBA::ORB_ptr,
- PortableServer::POA_ptr,
- PortableServer::ObjectId *,
- const char *,
- const char *))
+ PortableServer::POA_ptr,
+ PortableServer::ObjectId *,
+ const char *,
+ const char *))
dlsym(handle, factory_name.c_str());
char *error ;