paia-hw3/pyr/test.py

21 lines
297 B
Python
Executable File

#!/usr/bin/env python3
from ctypes import *
mylib = cdll.LoadLibrary("./target/release/libpyr.so")
class Point(Structure):
_fields_ = [("x", c_uint64), ("y", c_uint64)]
point=Point()
point.x=1
point.y=2
ptr=pointer(point)
print(ptr)
mylib.set_point(ptr)
print(point.x)
print(point.y)