Skip to content

Instantly share code, notes, and snippets.

@maxfire2008
Created June 15, 2021 03:13
Show Gist options
  • Save maxfire2008/674fbcbd6491066e234b519d4be4902e to your computer and use it in GitHub Desktop.
Save maxfire2008/674fbcbd6491066e234b519d4be4902e to your computer and use it in GitHub Desktop.
#include <stdio.h>
int examplefunction(int input) {
return input * 22;
}
from ctypes import *
so_file = "compiledfile.so"
my_functions = CDLL(so_file)
print(type(my_functions))
print(my_functions.examplefunction(10))
cc -fPIC -shared -o compiledfile.so csource.c
python3 pysource.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment