cluster_toolkit icon indicating copy to clipboard operation
cluster_toolkit copied to clipboard

Consistent ffi

Open jhod0 opened this issue 5 years ago • 1 comments

This PR makes two main changes for consistent interfacing with C code, and error handling:

  • Passing arrays to C routines is now handled with the _ArrayWrapper class, which always ensures arrays are the right type, and contiguous in memory (to avoid memory corruption). It also consistently handles passing single values to C routines.
  • C routines using GSL functions now return the GSL error code to the Python wrapper. If retcode != GSL_SUCCESS, an error is thrown in Python. This ensures that errors are always detected, and makes it possible to handle them explicitly in Python.

jhod0 avatar Aug 07 '19 15:08 jhod0

Seems like the first bullet above addresses #9 as well

jhod0 avatar Aug 07 '19 16:08 jhod0