Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"If truth is beauty, how come no one has their hair done in the library?" -- Lily Tomlin


devel / comp.lang.python / Re: ctypes on Windows question: How to access an array of uint32_t exported from a DLL?

SubjectAuthor
o Re: ctypes on Windows question: How to access an array of uint32_tEryk Sun

1
Re: ctypes on Windows question: How to access an array of uint32_t exported from a DLL?

<mailman.1.1623083636.4164.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13588&group=comp.lang.python#13588

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: eryk...@gmail.com (Eryk Sun)
Newsgroups: comp.lang.python
Subject: Re: ctypes on Windows question: How to access an array of uint32_t
exported from a DLL?
Date: Mon, 7 Jun 2021 11:33:52 -0500
Lines: 16
Message-ID: <mailman.1.1623083636.4164.python-list@python.org>
References: <000201d75b52$414dc2a0$c3e947e0$@earthlink.net>
<CACL+1as6etV13VNwwK9cpCVHJb=VNtUt-YgOd4cwH0azHFzX1A@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de lVw9Ou7s7V736Eg9zRFZfwnAeltCCv1VXh/zCtgf6AVA==
Return-Path: <eryksun@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=ebH1+PtU;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.003
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'pfxlen:0': 0.04;
'subject:Windows': 0.07; '(python': 0.09; 'example:': 0.09;
'skip:_ 20': 0.09; 'symbol': 0.09; 'cc:no real name:2**0': 0.13;
'exported': 0.16; 'extern': 0.16; 'instance': 0.16; 'wrote:':
0.16; 'subject:question': 0.18; 'name.': 0.20; 'subject:How':
0.22; 'returns': 0.23; 'to:addr:python-list': 0.23; 'cc:2**0':
0.27; 'library': 0.27; 'takes': 0.31; 'shared': 0.31; 'message-
id:@mail.gmail.com': 0.33; 'header:In-Reply-To:1': 0.33;
'received:google.com': 0.34; 'subject:from': 0.35;
'from:addr:gmail.com': 0.35; 'windows': 0.36; 'received:209.85':
0.38; 'received:209.85.210': 0.38; 'received:209': 0.38; 'use':
0.38; 'url-ip:151.101.36.223/32': 0.38; 'url-ip:151.101.36/24':
0.38; 'skip:1 20': 0.67; '[1]': 0.68
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to
:cc; bh=cO17RkLmeLtxrgXwhphNB3nCUGRWUvSf/4tvOGZ4n5Y=;
b=ebH1+PtUQ1RdooGCafBH1DNEuivG54f5l3YJ81vMt8OtOHejyVa8BF3cI7UQB2lAx/
Sb/ahmijM6OaTydLIAxYezgv7iIMWpp7fmWUHElztfMxY2usRCCdA15sLlV3r15qbHvD
NhwLoZHMD3eQFfLKOf3h3RLcMn4kIW3ZS6c4/mUSA7YBhmKh+WuVXHxfNNoMbW6Et+C5
4jPtpUZUrJMNxTDC5z5Rw0iXSkDF8c/MsYn7k2pXBqspkWVk530EOIVP6knXcR0xmPZI
5+xsBtX1j5yuVc7sbiaWvYig25T3GNvQvM7AMrEMJls7DwoY+dMfP+gDa5RUQTD4TIAY
8MBA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:in-reply-to:references:from:date
:message-id:subject:to:cc;
bh=cO17RkLmeLtxrgXwhphNB3nCUGRWUvSf/4tvOGZ4n5Y=;
b=YqzGI46K3PZw5nyXijBp6JGSfQDoA8/8QO2MGu6zu88vH0MTq/QWftJt8tl8NAYNBy
Wz7lkHWkL48FE9AHbbiY4+kDklp7O2/yQNKGSIAKWFQ0zWyhiriAv9eLui0vCbuvfwmE
BHQ9zgNwu9kq18kg/I1HYOkr/Zre2nk8KNyVezbRj5p8Fg3fGxihHg9ecsxER3ktAAIj
b9o1F7Yqk1E90y/yiJUUzslw4NC0+EboJkphrzRmWveqdRq8giVJd/EsaSynzghQfHkn
vMM26wSGmDY3C9CSiEY3RW9/vEOK04juj1l+OW1Iqh730GLArXs3/Kox/BnUT6HNQGK5
qX2w==
X-Gm-Message-State: AOAM530PMFNPZ9JVJLx6bLGnwyPbgfrFtRLw5XNGuNSrOS52penuGD1P
XiT7eDRmfvILrWpBMEzEoWgJCidt/XkY2rZI0B2qH5Q3
X-Google-Smtp-Source: ABdhPJyL2EehqG2WJzt9Cw40YL5DoNabMDR/3nDtIiOGznl2RGfHO258jzY94Kz/2A8QTsNNZITD4ngMEjq+s5VFoyI=
X-Received: by 2002:a63:1109:: with SMTP id g9mr18559825pgl.358.1623083633203;
Mon, 07 Jun 2021 09:33:53 -0700 (PDT)
In-Reply-To: <000201d75b52$414dc2a0$c3e947e0$@earthlink.net>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CACL+1as6etV13VNwwK9cpCVHJb=VNtUt-YgOd4cwH0azHFzX1A@mail.gmail.com>
X-Mailman-Original-References: <000201d75b52$414dc2a0$c3e947e0$@earthlink.net>
 by: Eryk Sun - Mon, 7 Jun 2021 16:33 UTC

On 6/6/21, pjfarley3@earthlink.net <pjfarley3@earthlink.net> wrote:
>
> On a Windows 10 platform (python 3.8.9 and 3.9.5), how do I use ctypes to
> access an array of uint32_t's exported from a DLL?
> ...
> __declspec(dllexport) extern uint32_t array_name[128];

A ctypes data type has an in_dll() method [1] that returns an instance
of the type that references data in a shared library (DLL). It takes a
CDLL instance for the shared library and the exported symbol name. For
example:

data = (ctypes.c_uint32 * 128).in_dll(library, "array_name")

---
[1] https://docs.python.org/3/library/ctypes.html#ctypes._CData.in_dll

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor