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


Groups > comp.lang.python > #10842

Re: making my extensions work together

From Stefan Behnel <stefan_ml@behnel.de>
Subject Re: making my extensions work together
Date 2011-08-04 08:00 +0200
References <j1cs2t$j2f$1@news.jpl.nasa.gov>
Newsgroups comp.lang.python
Message-ID <mailman.1877.1312437652.1164.python-list@python.org> (permalink)

Show all headers | View raw


Mathew, 04.08.2011 03:19:
> This isn't exactly a Python question but maybe someone here has run into
> this.
>
> I have 2 extensions

With "extensions", I assume you mean extension modules for the CPython 
runtime that are written in C? It would help if you were more specific in 
your problem description.


> and they both access a function in a (static) library.

It would help if you mentioned the names of the modules (or packages) and 
of the external library.


> The function maintains state information using a static variable.

That's bad design, but it happens.


> This doesn't work. When one of my extensions changes the variable value, the
> other extension does not see the change.

Are the two modules linked in any way or are they just arbitrary modules 
that happen to be installed at the same time, trying to use the same 
external C library?

If the former, consider letting them communicate with each other by making 
one depend on the other. If you control the source code, you may also 
consider wrapping the library only once and reusing that from the two 
modules. Or, just move the configuration part into a separate module and 
have both depend on that. Or, try to dump the dependency on the static 
variable.

If the latter, then, well, it depends on several environmental factors that 
you left out in your question.


> Would it work if I made my library dynamic?

That's usually a good idea, but it's unlikely to help in this specific case.


> This is on Windows XP compiling with MSVC 2008.

Others will know more here.

Stefan

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

making my extensions work together "Mathew" <myeates@jpl.nasa.gov> - 2011-08-03 18:19 -0700
  Re: making my extensions work together John Gordon <gordon@panix.com> - 2011-08-04 03:22 +0000
  Re: making my extensions work together Stefan Behnel <stefan_ml@behnel.de> - 2011-08-04 08:00 +0200
  Re: making my extensions work together Chris Angelico <rosuav@gmail.com> - 2011-08-04 08:08 +0100
    Re: making my extensions work together "Mathew" <myeates@jpl.nasa.gov> - 2011-08-04 06:48 -0700
  Re: making my extensions work together "Mathew" <myeates@jpl.nasa.gov> - 2011-08-04 07:04 -0700

csiph-web