Skip to content

About

This Repo contains all info about how to call the c function in python.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CandPythonBridge

A learning example for calling C functions from Python with ctypes.

Basic workflow

  1. Write the C function in a source file.
  2. Declare the function in a header file.
  3. Compile the C source as a shared library.
  4. Load the shared library from Python with ctypes.CDLL.
  5. Call the exported function from Python.

The exact compiler command depends on the operating system and compiler. The older example in this repository uses Linux-style shared-library tooling and should be adapted rather than copied unchanged to every platform.

Author

Tejas Dixit — https://tejasdixit.in

About

This Repo contains all info about how to call the c function in python.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages