So I have a boost python extension C++ library. I would like to access the "python commandline" in C++ without having to pass in the "sys.argv" into my C++ extension. Is there a way to do this? Include some boost python header and read it from some init variables or something?
e.g. python someScript.py A B C 1 2 3 ////////////////////////////////////////////////////////////////////////// class_<DummyCppClass> ("DummyCppClass", "DummyCppClass obj", init<>()) .def("printCmdLine", &DummyCppClass::printCmdLine) ; ////////////////////////////////////////////////////////////////////////// #include <string> #include <iostream> std::string DummyCppClass::printCmdLine() const { std::cout << "Prog: " << HERE_argv[0] << ", Arg1: " << HERE_argv[1] << std::endl; } ////////////////////////////////////////////////////////////////////////// ============================================================================================= Email transmissions can not be guaranteed to be secure or error-free, as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of email transmission. In addition, the information contained in this email message is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution,or copying of this communication, disclosure of the parties to it, or any action taken or omitted to be taken in reliance on it, is strictly prohibited, and may be unlawful. If you are not the intended recipient please delete this email message. ==============================================================================================
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig