using namespace std;
using namespace YACS::ENGINE;
-void RuntimeSALOME::setRuntime(long flags) // singleton creation (not thread safe!)
+void RuntimeSALOME::setRuntime(long flags, int argc, char* argv[]) // singleton creation (not thread safe!)
{
if (! Runtime::_singleton)
{
- RuntimeSALOME* r=new RuntimeSALOME(flags);
+ RuntimeSALOME* r=new RuntimeSALOME(flags, argc, argv);
Runtime::_singleton = r;
r->initBuiltins();
}
typeMap["dataref"]= t;
}
-RuntimeSALOME::RuntimeSALOME(long flags)
+RuntimeSALOME::RuntimeSALOME(long flags, int argc, char* argv[])
{
// If all flags (apart the IsPyExt flags) are unset, force them to true
if ((flags - flags & RuntimeSALOME::IsPyExt) == 0)
if (_usePython) _setOfImplementation.insert(PythonNode::IMPL_NAME);
if (_useCorba) _setOfImplementation.insert(CORBANode::IMPL_NAME);
if (_useXml) _setOfImplementation.insert(XmlNode::IMPL_NAME);
- init(flags);
+ init(flags, argc, argv);
}
RuntimeSALOME::~RuntimeSALOME()
*
*/
-void RuntimeSALOME::init(long flags)
+void RuntimeSALOME::init(long flags, int argc, char* argv[])
{
bool ispyext = flags & RuntimeSALOME::IsPyExt;
if (_useCorba)
#else
Py_InitializeEx(0); // do not install signal handlers
#endif
+ PySys_SetArgv(argc, argv);
PyEval_InitThreads(); /* Create (and acquire) the interpreter lock (for threads)*/
PyEval_SaveThread(); /* Release the thread state */
//here we do not have the Global Interpreter Lock
UseSalome = 32
} FLAGS;
- static void setRuntime(long flags = UsePython+UseCorba+UseXml+UseCpp+UseSalome); // singleton creation
+ // singleton creation
+ static void setRuntime(long flags = UsePython+UseCorba+UseXml+UseCpp+UseSalome,
+ int argc = 0, char* argv[] = NULL);
friend RuntimeSALOME* getSALOMERuntime();
virtual std::string getVersion() const;
- virtual void init(long flags);
+ virtual void init(long flags, int argc, char* argv[]);
virtual void fini();
virtual InputPort* createInputPort(const std::string& name,
protected:
RuntimeSALOME(); // singleton
- RuntimeSALOME(long flags); // singleton
+ RuntimeSALOME(long flags, int argc, char* argv[]); // singleton
void initBuiltins();
CORBA::ORB_var _orb;
PyObject * _pyorb;
#endif
timer("Starting ");
- RuntimeSALOME::setRuntime();
+ long flags = RuntimeSALOME::UsePython + RuntimeSALOME::UseCorba + RuntimeSALOME::UseXml + \
+ RuntimeSALOME::UseCpp + RuntimeSALOME::UseSalome;
+ RuntimeSALOME::setRuntime(flags, argc, argv);
// Try to load the session catalog if it exists
try