Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added restypes to function that return pointers #12

Merged
merged 1 commit into from
Dec 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pycalcium/pyca.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class _fmpz_struct(ctypes.Structure):

# ctypes.cast(x, ctypes.POINTER(ctypes.c_ulong))
# ctypes.POINTER(ctypes.c_ulong)
libflint.flint_malloc.restype = ctypes.c_void_p

class ca_struct(ctypes.Structure):
"""Low-level wrapper for ca_struct, for internal use by ctypes."""
Expand All @@ -87,18 +88,25 @@ class ca_mat_struct(ctypes.Structure):
('c', ctypes.c_long),
('rows', ctypes.c_void_p)]

libcalcium.ca_mat_entry_ptr.restype = ctypes.POINTER(ca_mat_struct)

class ca_vec_struct(ctypes.Structure):
"""Low-level wrapper for ca_vec_struct, for internal use by ctypes."""
_fields_ = [('entries', ctypes.c_void_p),
('length', ctypes.c_long),
('alloc', ctypes.c_long)]

libcalcium.ca_vec_entry_ptr.restype = ctypes.POINTER(ca_vec_struct)


class ca_poly_struct(ctypes.Structure):
"""Low-level wrapper for ca_poly_struct, for internal use by ctypes."""
_fields_ = [('coeffs', ctypes.c_void_p),
('length', ctypes.c_long),
('alloc', ctypes.c_long)]

libcalcium.ca_poly_coeff_ptr.restype = ctypes.POINTER(ca_struct)

class ca_poly_vec_struct(ctypes.Structure):
"""Low-level wrapper for ca_poly_vec_struct, for internal use by ctypes."""
_fields_ = [('entries', ctypes.POINTER(ca_poly_struct)),
Expand Down