[C++-sig] How can I get access to "argv/argc" command line in a boost python c++ extension?

Stefan Seefeld stefan at seefeld.name
Fri Jan 26 17:47:23 EST 2018


On 26.01.2018 16:20, Liam Herron wrote:
>
> 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?
>

You don't have to pass `sys.argv` as an argument. You can inspect it
from wherever you need it. Just import `sys` and inspect the elements of
`sys.argv`, just as you would do in Python.


Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...
    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20180126/cfa62431/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.png
Type: image/png
Size: 1478 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20180126/cfa62431/attachment.png>


More information about the Cplusplus-sig mailing list