Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83367 > unrolled thread

exporting c_variable to embedded python module

Started bykenakahn@gmail.com
First post2015-01-08 13:03 -0800
Last post2015-01-08 18:16 -0800
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  exporting c_variable to embedded python module kenakahn@gmail.com - 2015-01-08 13:03 -0800
    Re: exporting c_variable to embedded python module Chris Angelico <rosuav@gmail.com> - 2015-01-09 10:47 +1100
    Re: exporting c_variable to embedded python module kenakahn@gmail.com - 2015-01-08 18:16 -0800

#83367 — exporting c_variable to embedded python module

Fromkenakahn@gmail.com
Date2015-01-08 13:03 -0800
Subjectexporting c_variable to embedded python module
Message-ID<ec235ae5-d926-4747-9a8f-2952956a2494@googlegroups.com>
I'm running a python script loaded via PyImport_Import in my C++ program on Linux.  Is there any way I can pass a value from the c-code to the loaded python module?

[toc] | [next] | [standalone]


#83372

FromChris Angelico <rosuav@gmail.com>
Date2015-01-09 10:47 +1100
Message-ID<mailman.17486.1420760852.18130.python-list@python.org>
In reply to#83367
On Fri, Jan 9, 2015 at 8:03 AM,  <kenakahn@gmail.com> wrote:
> I'm running a python script loaded via PyImport_Import in my C++ program on Linux.  Is there any way I can pass a value from the c-code to the loaded python module?

To answer this question, first think about how you would like to see
that value on the Python side. Does your C code call a function in
that module? If so, it can pass it a parameter. Or do you want the
top-level import to be aware of something? It might be best to put
something into another module, maybe even builtins. What makes sense
from the Python end? Pretty much anything can be done.

ChrisA

[toc] | [prev] | [next] | [standalone]


#83390

Fromkenakahn@gmail.com
Date2015-01-08 18:16 -0800
Message-ID<6f5ab1ed-e51a-4487-baa7-2296a00edfac@googlegroups.com>
In reply to#83367
I want to access c-side global variables from the python side.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web