Python에서 ctypes를 이용하여 구조체 얻어오기
- 먼저 MSVC++(Express 버전)에서 dll을 만든다. dll의 내용이 되는 소스는 다음과 같다. // PyDll.cpp -> PyDll.dll struct St { int x; char * str; double f; }; extern "C" __declspec(dllexport) void func(void* st) { St temp = {1, "Hello", 3.14}; *((St*)st) = temp; } - Python에서 dll을 import한 다음 dll에 정의되어 있는 구조체와 동일한 구조를 갖는 ctypes.Structure를 정의한다. 그 다음 정의한 ctypes.Structure의 객체를 byref()를 통해 dll에 있는 함수에게 넘겨준다. from ctypes import *..
Python/요리 방법
2009. 10. 27. 23:38
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 이상한 문자
- dll
- QPrinter.Letter
- 볼륨 조절
- Visual C++
- Python
- pandas
- armadillo c++
- CanDrA
- cython
- Item 9
- MSVC++
- QT
- Accelerated C++
- volume dial
- TCGA
- structure
- ctypes
- how to solve it
- PyQt
- TensorBoard
- destructor
- C++
- matrix multiplication
- QPrinter.A4
- tensorflow
- 볼륨 낮춤
- GSX 1200 pro
- GSX 1000 pro
- 설치
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함