update
This commit is contained in:
8
2025.07.27_programming_with_python_and_c/example_2/a.py
Normal file
8
2025.07.27_programming_with_python_and_c/example_2/a.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from ctypes import cdll
|
||||
|
||||
lib = cdll.LoadLibrary('./example.so') # Linux 系统
|
||||
# lib = cdll.LoadLibrary('./example.dll') # Windows 系统
|
||||
|
||||
# 调用 C 函数
|
||||
result = lib.add_two_numbers(3, 5)
|
||||
print(result)
|
@@ -0,0 +1,3 @@
|
||||
int add_two_numbers(int a, int b) {
|
||||
return a + b;
|
||||
}
|
Reference in New Issue
Block a user