making my extensions work together
Mathew
myeates at jpl.nasa.gov
Thu Aug 4 09:48:11 EDT 2011
more info. I have a large 3rd party library with a function that looks like
this
void dumbfunc() {
static int statevar=0;
++statevar;
if (startvar ==3) printf("I have been called 3 times\n");
}
and I have 2 extensions, foo,py goo.py,created with SWIG, and the both make
calls to dumbfunc. In creating the extensions, I linked to the 3rd party
library.
The behavior I want to see is
>foo.dumbfunc()
>goo.dumbfunc()
>goo.dumbfunc()
I have been called 3 times
"Chris Angelico" <rosuav at gmail.com> wrote in message
news:mailman.1880.1312441742.1164.python-list at python.org...
> On Thu, Aug 4, 2011 at 2:19 AM, Mathew <myeates at jpl.nasa.gov> wrote:
>> I have 2 extensions and they both access a function in a (static)
>> library.
>> The function maintains state information using a static variable.
>
> If your extensions are DLLs and they're both linking to the same
> static library, you should have two independent copies of that library
> - which would mean they don't interfere with one another. That's why
> the other extension doesn't see the change, and normally this is the
> correct and desired behaviour.
>
> Having the two be aware of each other is potentially very messy. As
> Stefan suggested, making one depend on the other would be a lot
> simpler. Alternatively, there may be ways to have the two extensions
> share data through Python itself. What are you looking to accomplish?
>
> ChrisA
More information about the Python-list
mailing list