Google Colab Cell: < /p>
Code: Select all
%%writefile my_functions.c
#include
#include
void my_void_func() {
printf("my_void_func called from C!\n");
}
< /code>
Kompilierung: < /p>
!gcc -shared -fPIC -o my_functions.so my_functions.c
< /code>
Hier geht Python -Teil: < /p>
import ctypes
libc = ctypes.CDLL("libc.so.6")
my_lib = ctypes.CDLL("./my_functions.so")
my_lib.my_void_func.restype = None
my_lib.my_void_func()