Path: csiph.com!feeder.erje.net!1.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!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:26:08 +1000 Lines: 14 Message-ID: References: <1837656f-ef9a-4bcf-8074-c9565dd8c59a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de nace1FaaiUPWrbopKrPRvAtyqs5h5+5gzxjrnSeFYv7Q== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'binary': 0.05; 'cc:addr :python-list': 0.09; 'indicates': 0.09; 'subject:2.7': 0.09; 'subject:library': 0.09; 'bug': 0.10; 'python': 0.10; 'python.': 0.11; '2.7': 0.13; 'wed,': 0.15; 'subject: \n ': 0.15; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'numpy': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'still,': 0.16; 'subject:versus': 0.16; 'wrote:': 0.16; 'pointer': 0.18; 'library': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'ctypes': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'interface': 0.29; 'understand,': 0.29; 'array': 0.29; '(including': 0.30; 'code': 0.30; 'run': 0.33; 'correctly': 0.34; 'received:google.com': 0.35; 'c++': 0.35; 'quite': 0.35; 'received:74.125.82': 0.35; 'should': 0.36; 'depends': 0.36; 'stock': 0.36; 'subject:: ': 0.37; 'shared': 0.38; 'data': 0.39; 'some': 0.40; 'your': 0.60; 'matter': 0.63; 'fact,': 0.67; 'chrisa': 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 :content-transfer-encoding; bh=Zt8WwweCVo2XzjQYrwnnouBiq3GlFct1MUphaff4DlY=; b=xR8NEhGEH8nhyUJWjeTs7VqNDK04S6wBYSzJF3iNx84ycVaFzl74otpILNe2xm02d7 7APbhSI8xMSyxUi+hPxmGL03P4uClmDlBEgtl6lvcUof8+DY4QZvaY95fZL3VQV+QVkB Iv0Y/CRuW8+cJpe9RsdyTv4jsriV0oQTdnYbOt1oGIWC0AGCz5vzKpaNPzK+7P1QG0kh 4b+4CA7wtezhIO8MQBshqL/E8lNccioz06+qT/1Ezj6vtn04eqzT2HM4XNAJsCn/FsGP nv3mGqAgjeIETqENpLEQlpzoHB+zpvLLKI5NECzOONEZCPSxk+pkMASqRd/FyUWXrBDJ lEyA== 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:content-transfer-encoding; bh=Zt8WwweCVo2XzjQYrwnnouBiq3GlFct1MUphaff4DlY=; b=l6jME7RYQ/82P9VpRvTIJQBWaLp/ET6vBHPDe7qo0J9q27UkPq13vn0s7iT59vNDPK oafk4vB2BiTME0KBEZiMc+Fkl4D4ACAPmD+3ix4T1PBgzz3gePbaXiznvdivTPWbM3xV HOx5kOvZ/dizW7IZvQJXPa+Ub9CJPfGOiv7p/ENJsWqriHB2FUcnZMiFquuLK+uJRQ7t CMuf6m1mfAPUdddAxNyN5stW/Odaeha4dJqpEcsrqdzP1//xpq00La2QXSzFT8CMs/3M 04tJRVcU/1491JF50A2b5b0wtLw1RrHANn0E98YXxDbEkEPNsDxJXlTOur3gbOVTmHWr mf6w== X-Gm-Message-State: AOPr4FXcgY062CVx70ZhGRYtzSvnl+oIva1UK5B1CnhJXXWUSctXsAhggl8kECoDK+3kw/fpokKAb9QvSn85xA== X-Received: by 10.28.217.72 with SMTP id q69mr22958561wmg.81.1464107168794; Tue, 24 May 2016 09:26:08 -0700 (PDT) In-Reply-To: <1837656f-ef9a-4bcf-8074-c9565dd8c59a@googlegroups.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> Xref: csiph.com comp.lang.python:109065 On Wed, May 25, 2016 at 2:18 AM, Siyi Deng wrote: > I don't quite understand, the binary shared library contains no python in= terfaces, it should be independent of python. As a matter of fact, I have s= uccessfully used it in Conda python 2.7, 3.5, Julialang as well as c++ exe= cutables. I think the fact that only stock python 2.7 failed to run correct= ly indicates some bug in that python distribution. > Ah okay. Still, somehow you have to get the data from the numpy array to the binary library; and that depends on the exact layout of the Python object (including pointer sizes and stuff). So your ctypes interface code might need to be adjusted. ChrisA