Created
June 15, 2021 03:13
-
-
Save maxfire2008/674fbcbd6491066e234b519d4be4902e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int examplefunction(int input) { | |
return input * 22; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ctypes import * | |
so_file = "compiledfile.so" | |
my_functions = CDLL(so_file) | |
print(type(my_functions)) | |
print(my_functions.examplefunction(10)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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