Convert a python type to a pointer to a C type.
(data: T)
| 259 | |
| 260 | |
| 261 | def to_c_ptr(data: T) -> TypedCPointer[T]: |
| 262 | """Convert a python type to a pointer to a C type.""" |
| 263 | ct = map_type(data) |
| 264 | |
| 265 | add_ref(ct) |
| 266 | address = ctypes.addressof(ct) |
| 267 | typ = type(data) |
| 268 | |
| 269 | return TypedCPointer(address, typ, ctypes.sizeof(ct), False) |
| 270 | |
| 271 | |
| 272 | def to_struct_ptr(struct: A) -> "StructPointer[A]": |