Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'value,': 0.04; 'cpython': 0.05; 'modules.': 0.07; 'subject:making': 0.07; 'python': 0.08; 'dependency': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'runtime': 0.09; 'library': 0.15; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'happens.': 0.16; 'latter,': 0.16; 'library?': 0.16; 'msvc': 0.16; 'variable.': 0.16; 'case.': 0.16; 'extensions': 0.16; 'static': 0.16; 'question.': 0.16; 'written': 0.17; 'variable': 0.21; 'extension': 0.22; 'maybe': 0.22; "doesn't": 0.22; 'header:In- Reply-To:1': 0.22; 'trying': 0.23; 'assume': 0.23; 'unlikely': 0.23; 'library.': 0.25; '(or': 0.25; 'modules': 0.25; 'function': 0.26; 'windows': 0.26; 'work.': 0.28; 'depends': 0.28; 'stefan': 0.29; 'problem': 0.29; 'code,': 0.29; 'module': 0.30; 'compiling': 0.30; 'description.': 0.30; 'separate': 0.31; 'changes': 0.31; 'this.': 0.31; 'source': 0.32; 'change.': 0.32; 'does': 0.32; 'external': 0.33; 'usually': 0.33; 'to:addr:python-list': 0.34; 'header:X-Complaints-To:1': 0.34; 'header:User-Agent:1': 0.34; 'someone': 0.34; 'maintains': 0.35; 'installed': 0.35; "isn't": 0.35; 'question': 0.35; 'skip:" 10': 0.36; 'depend': 0.37; 'but': 0.37; 'several': 0.37; 'using': 0.37; 'received:org': 0.38; 'subject:: ': 0.38; 'linked': 0.38; 'two': 0.38; 'run': 0.39; 'header:Mime-Version:1': 0.39; 'help': 0.39; 'to:addr:python.org': 0.39; 'or,': 0.40; 'your': 0.60; 'happen': 0.62; 'other.': 0.62; 'here': 0.66; 'making': 0.66; 'here.': 0.66; 'received:188': 0.69; '2008.': 0.91; 'factors': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Behnel Subject: Re: making my extensions work together Date: Thu, 04 Aug 2011 08:00:37 +0200 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: ppp-188-174-3-226.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2 Thunderbird/3.1.11 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 51 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1312437652 news.xs4all.nl 23861 [2001:888:2000:d::a6]:57970 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10842 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