ctypes

    0熱度

    2回答

    我試圖將一些診斷添加到嵌套的ctypes結構,但未能如此,並想知道原因。什麼作品如預期的那樣裸機例如: import ctypes class FirstStruct(ctypes.Structure): _fields_ = [('ch', ctypes.c_ubyte)] f = FirstStruct() print type(f) print hasattr(f,

    0熱度

    2回答

    我做了一個需要執行C函數的Python應用程序。爲此,我使用gcc將C函數編譯到共享庫中,並使用ctypes在我的Python腳本中調用該庫。 我試圖在pip包中打包我的應用程序,但發現無法在pip安裝時創建共享庫。 我嘗試以下(setup.py): from setuptools import setup from setuptools.command.install import insta

    0熱度

    1回答

    我有一個C結構如下所示: typedef struct _DXYZ { DXYZSTATE State[]; } DXYZ, *PDXYZ 本質上,的DXYZSTATE陣列,未知大小的。 當我試圖在​​中聲明這個結構時,我不知道該怎麼做。 class DXYZ(Structure): _fields_ = [ ('State', ???) ] 我

    0熱度

    1回答

    說完看着這樣一個問題: ctypes: How do I define an array of a structure as a field of another structure? 現在我想實現我的版本的解決方案,但在len_a的struct Arr輸出不同於它在C中的設置。我的問題是:什麼是將Parse.arr設置爲python中的一個Arr對象數組的正確方法是什麼?(最初是在C中分配/設置

    0熱度

    1回答

    按照GSL文檔的簽名是: double gsl_stats_correlation (const double data1[], const size_t stride1, const double data2[], const size_t stride2, const size_t n) 當我嘗

    0熱度

    1回答

    下面 typedef struct _node_t { int value; struct _node_t* next; } node_t; 的c頭可譯爲像的下方。 class node_t(Structure): pass node_t._fields_ = [ ('value', ctypes.c_int), ('next', POINTER(n

    0熱度

    2回答

    Ç陣列我有一個C函數: void func(int n, int m) { int Array[n][m]; make_magic(Array); } 這使得2D陣列和處理它。我在python3.5使用本功能與ctypes的是這樣的: from ctypes import * magic = CDLL('lib_name') magic.func(n,m) 所

    0熱度

    1回答

    我們使用有源RFID建設項目,該RFID需要在Python來進行編碼,以便使用它在樹莓PI3有源RFID SAAT RFID已經有DLL文件, RFIDAPI.lib和RFIDAPIEXPORT.h和各種API調用函數 例如和基本代碼,我需要執行 bool SAAT_TCPInit (void** pHandle,char *pHostName,int nsocketPort) HANDLE h

    1熱度

    1回答

    我有一個包含原始字段(int,uint8,...)和指針的結構。 這些指針通常指向一個不同結構類型的數組,以保持深度嵌套結構。 例如,在C: struct A { int field1; int field2; struct B *fields3; unsigned int countofb; } struct B { int anotherfield1; i

    0熱度

    1回答

    我一直負責在python中使用 ctypes創建一個包裝類。我一直在編寫和研究過去幾周的 ,並有任何願意幫助的人的問題。這個C代碼是我正在使用的代碼的最佳複製,所以請記住,我沒有按照提供的方式構建代碼! 我是比較新的Python和的ctypes的圖書館 在Linux上 Question: When I try to run the following python code, I get this