Skip to content

Instantly share code, notes, and snippets.

View bigwhite's full-sized avatar

Tony Bai bigwhite

View GitHub Profile
import ctypes
import os
# 1. 加载 Go 编译的动态库
# 注意:路径可能需要根据你的操作系统调整
lib = ctypes.CDLL(os.path.join(os.getcwd(), "libmymath.so"))
# 2. 定义函数的参数和返回类型 (类型映射)
lib.Add.argtypes = [ctypes.c_int, ctypes.c_int]
lib.Add.restype = ctypes.c_int