Upload
-
View
753
Download
10
Embed Size (px)
DESCRIPTION
Citation preview
ctypesa foreign function library for Python
交大資工系 103級戴嘉駿 /darkgerm<[email protected]>
How can Python combine with C ? Python API Python built-in module - ctypes third party module (ex: boost.python, SWIG)
What is ctypes A foreign function library for Python. It provides C compatible data types. It allows calling functions in DLLs or shared
libraries.
ctypes History 1
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!
Fundamenta data types
Structures and Unions
Example on stackoverflow
Example on stackoverflow
Example on stackoverflow
Example on stackoverflow
Example on stackoverflow
Example on stackoverflow
Example on stackoverflow
Any problems?
Modify the Example
Modify the Example
Modify the Example
Modify the Example
function prototypes
function prototypes
Who use ctypes?
Who use ctypes?
Who use ctypes?
Thank you for listening!!
Ref: http://docs.python.org/library/ctypes.html http://stackoverflow.com/questions/145270/calling-c-c-from-python http://stackoverflow.com/questions/135834/python-swig-vs-ctypes http://
stackoverflow.com/questions/1942298/wrapping-a-c-library-in-python-c-cython-or-ctypes
https://www.google.com/