16 lines
365 B
Python
16 lines
365 B
Python
import ctypes
|
|
import os
|
|
|
|
lib_path = "/usr/local/lib/libadder.so"
|
|
c_lib = ctypes.CDLL(lib_path)
|
|
|
|
c_lib.addiere_zahlen.argtypes = [ctypes.c_int32, ctypes.c_int32]
|
|
c_lib.addiere_zahlen.restype = ctypes.c_int32
|
|
|
|
zahl_a = 33
|
|
zahl_b = 34
|
|
|
|
ergebnis = c_lib.addiere_zahlen(zahl_a, zahl_b)
|
|
|
|
print(f"Zahlen: {zahl_a} + {zahl_b}")
|
|
print(f"Ergebnis von C-Funktion: {ergebnis}") |