Ctypes

darkgerm 888 views 24 slides Aug 23, 2012
Slide 1
Slide 1 of 24
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24

About This Presentation

No description available for this slideshow.


Slide Content

ctypes a 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)

W hat 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 s tackoverflow

Example on s tackoverflow

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/
Tags