CTypes: Dynamic Link Library Written Using Python Call C

xiaoxiao2021-03-06  16

Ctypes is a Python module that uses him to create and operate the C language in Python, which can pass the parameters to C in the dynamic link library.

The founder of Python must be quoted Van Rossum. VAN Rossum is evaluated for CTypes: CTypes is Very Cool! Great Piece Of Work. Ctypes can be used on multiple platforms such as Windows / Linux, and even support COM development on Windows! For CTypes, I feel the same as Van Rossum :). Fissen, in Windows, "Hello World", ":

>>> from ctypes import * >>> messagebox = windll.user32.MessageBoxa >>> Messagebox (0, 'Hello, World!', 'First CTypes program', 0) # call function

Everyone can see a standard Windows message box that pops up, it's so simple :-) When you write Windll.user32, you will automatically transfer User32.dll's Windows dynamic library; Windll.user32.MessageBoxa directly quoted User32 The messagebox function in the .dll dynamic library. Such a simple, beautiful, C / C programmer is estimated to be 妒 :-) can be downloaded and installed

The latest version 0.96, pay attention to the version of Python2.3 or more

转载请注明原文地址:https://www.9cbs.com/read-45358.html

New Post(0)