[C++-sig] Argument handling, char** in constructor

Wolfgang Langner wl at flexis.de
Thu Aug 21 16:20:12 CEST 2003


Hello,

I use boost.python 1.30 with python 2.2.3 under Windows (VC6).

My python module interfaces to a C++ class that has the following
constructor:

MyClass(int* argc = 0, char** argv = 0);

In boost.python I exposed it with:
<some stuff> ...
.def(init<optional<int*, char**> >())

This works only if I have no arguments.
The problem is, I have to pass arguments from the command line
(called python programm) to the C++ class. (same as in main())

First I tried to solve it with a small wrapper class that
inherits from the C++ class and maps a python list of strings
to that interface. But that don't work because the C++ class
is a singleton.


Are ther any suggestions to expose this class to python ?


Thank you.

bye by Wolfgang






More information about the Cplusplus-sig mailing list