Created
January 9, 2015 01:06
-
-
Save jaseg/5bdce1111ddf28c33647 to your computer and use it in GitHub Desktop.
Extremely simple ctypes example
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
// compile with $ gcc -o test.so -shared test.c | |
int fnord(int a, int b){ | |
return a+4*b-1; | |
} |
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
import ctypes as ct | |
test = ctypes.CDLL('./test.so') | |
test.fnord(23, 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment