24
ctypes a foreign function library for Python 交交交交交 103 交 交交交 /darkgerm <[email protected]>

Ctypes

  • Upload
    -

  • View
    753

  • Download
    10

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Ctypes

ctypesa foreign function library for Python

交大資工系 103級戴嘉駿 /darkgerm<[email protected]>

Page 2: Ctypes

How can Python combine with C ? Python API Python built-in module - ctypes third party module (ex: boost.python, SWIG)

Page 3: Ctypes

What is ctypes A foreign function library for Python. It provides C compatible data types. It allows calling functions in DLLs or shared

libraries.

Page 4: Ctypes

ctypes History 1

Page 5: Ctypes

Reasons to use ctypes more portable between implementations

of Python. It has a much lower startup cost. It is in Python Standard Library. you're still writing Python!

Page 6: Ctypes

Fundamenta data types

Page 7: Ctypes

Structures and Unions

Page 8: Ctypes

Example on stackoverflow

Page 9: Ctypes

Example on stackoverflow

Page 10: Ctypes

Example on stackoverflow

Page 11: Ctypes

Example on stackoverflow

Page 12: Ctypes

Example on stackoverflow

Page 13: Ctypes

Example on stackoverflow

Page 14: Ctypes

Example on stackoverflow

Any problems?

Page 15: Ctypes

Modify the Example

Page 16: Ctypes

Modify the Example

Page 17: Ctypes

Modify the Example

Page 18: Ctypes

Modify the Example

Page 19: Ctypes

function prototypes

Page 20: Ctypes

function prototypes

Page 21: Ctypes

Who use ctypes?

Page 22: Ctypes

Who use ctypes?

Page 23: Ctypes

Who use ctypes?