Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Interfacing a dynamic shared library gives me different results in 2.7 versus 3.5 Date: Wed, 25 May 2016 02:45:30 +1000 Lines: 20 Message-ID: References: <1837656f-ef9a-4bcf-8074-c9565dd8c59a@googlegroups.com> <5744820e$0$1604$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 7/dGn8r7mLDRiFHF5owSNQGHyVd4SF114ircVqnlyykQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'binary': 0.05; 'wrapper': 0.07; 'cc:addr:python-list': 0.09; 'subject:2.7': 0.09; 'subject:library': 0.09; 'python': 0.10; 'python.': 0.11; 'received:74.125.82.44': 0.15; 'wed,': 0.15; 'subject: \n ': 0.15; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'in-memory': 0.16; 'numpy': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:versus': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'passes': 0.18; 'python?': 0.18; 'library': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'along.': 0.22; 'ctypes': 0.22; 'am,': 0.23; 'header:In-Reply- To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'understand,': 0.29; "i'm": 0.30; 'code': 0.30; 'certain': 0.31; "d'aprano": 0.33; 'steven': 0.33; 'received:google.com': 0.35; 'quite': 0.35; 'received:74.125.82': 0.35; 'but': 0.36; 'should': 0.36; 'basic': 0.36; 'subject:: ': 0.37; 'shared': 0.38; 'some': 0.40; 'your': 0.60; 'address': 0.61; 'skip:u 10': 0.61; 'series': 0.65; 'surprise': 0.72; 'chrisa': 0.84; 'post,': 0.84; 'to:none': 0.91; 'subject:results': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc; bh=+5wiMC3gkb8nar47W7QN2zNNo0EYJCOOh/hiH0lyCJ4=; b=gEvXhgoQ0TatSAul0enoCqFQ4wCrcYudRtDGmrLZ6spKhCXyugFH03UgrxD61JXNoo vTUpHXF07KVg4Kf0ZKP4bNNRRh52rlGUu5FqcLPBhIMMIMyl9+Beab0B3Rg2k1EH0Nx2 RUI6uYkdOmUwePiul4LZXmvJaD+P0gwp57IagYWdthL3p48OgwDs2kGXgknX2EzCsAAH vwsfFDOP11eV9Eb+hhGtDp1Noa5Rl9up3eS74AaBhwz2YPCHD+ypF0S4/7R6y4p380/2 XOqwBRs6rswv+I0gJ8ZDMSKNd3IObYkcQj4/YAYHjfi8BJEo46t5oWBL9v0JTPCxwIq7 JcAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=+5wiMC3gkb8nar47W7QN2zNNo0EYJCOOh/hiH0lyCJ4=; b=Nm+PfA6u6YnJQqSV5l0hF0smv8p3AE2UbcTKvIPSdOTagrlleW+/gvs7VGEBi1EvQi VLWodRPP9pmzs3CNGFeWlk71t5E0gJCkBQJ70ssu11A1ksLbD09zJkWBHCRyT1IPtdZz WLSPLkeQC2TNtFJ5N2i7q9cHX476RXKRdiUW0tOjEdvzxGaW7+mbBF2iVpHtMFIz4+kQ dOth2ex0q0ek2NwcjaZkZ6blT6x00KJnCp0KnKxFE8YCEGOcN31KMpRn8LdMRGKs2P/X YCPqyB2OkHWX9WIeApBv9qjomtlT0RiM0OkgZtKahCVaC/pm9RpLdKQ8n3CcnlvezsiF 2jUg== X-Gm-Message-State: AOPr4FUwH5qdNgmUg1Ywha0eaM+xfBlsYZXXJwUacFPujf3ExE28IfM8DrIWB7hEj8PcgNJgENUq/KMLyZp6dw== X-Received: by 10.28.142.137 with SMTP id q131mr23087815wmd.81.1464108330811; Tue, 24 May 2016 09:45:30 -0700 (PDT) In-Reply-To: <5744820e$0$1604$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <1837656f-ef9a-4bcf-8074-c9565dd8c59a@googlegroups.com> <5744820e$0$1604$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:109068 On Wed, May 25, 2016 at 2:32 AM, Steven D'Aprano wrote: > On Wed, 25 May 2016 02:18 am, Siyi Deng wrote: > >> Hello ChrisA, >> I don't quite understand, the binary shared library contains no python >> interfaces, it should be independent of python. > > In your first post, you said you were using numpy. How is that independent > of Python? I'm not certain of the in-memory representation of a numpy array, but it wouldn't surprise me if it's just a series of consecutive ints/floats - which would be exactly what a C or Fortran library will be expecting. So my understanding is that there's some basic ctypes wrapper code to locate the base address of the array, and then it passes that straight along. Of course, without seeing the code.... ChrisA