Created
May 5, 2022 23:10
-
-
Save mdboom/8f84bde1e0e5299c375c68fc845b074d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
gcc -c -fPIC test.c | |
gcc -shared -o liba.so test.o |
This file contains hidden or 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
int int_foo_int(int a) { | |
return a + 1; | |
} |
This file contains hidden or 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 timeit | |
print( | |
timeit.timeit( | |
"ext.int_foo_int(1)", | |
setup="from ctypes import cdll; ext = cdll.LoadLibrary('./liba.so')", | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment