Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call C functions from python?

Tags:

python

ctypes

I have a scenario where GUI (Developed in VB) is sending commands to the target system application developed in C language (Xilinx).

User on a PC sends the commands to target using GUI.

But now I need to remove the GUI and want to send commands (call C functions in target system application) using Python.

I found some useful info from ctypes but don't know the exact procedure so getting budded up frequently.

Question :

Can anyone tell me the exact procedure to develop a python script for this. I know fair amount of python scripting.

like image 592
Nakul Avatar asked May 29 '26 03:05

Nakul


1 Answers

Invoke a SWIG wrapper to make C functions look like Python functions. Take a look at this example.

like image 70
Sanjay Avatar answered May 30 '26 17:05

Sanjay