registerCustomOpsLibrary method

Pointer<OrtStatus> registerCustomOpsLibrary(
  1. Pointer<OrtSessionOptions> options,
  2. Pointer<Char> libraryPath,
  3. Pointer<Pointer<Void>> libraryHandle
)

Implementation

Pointer<OrtStatus> registerCustomOpsLibrary(
  Pointer<OrtSessionOptions> options,
  Pointer<Char> libraryPath,
  Pointer<Pointer<Void>> libraryHandle,
) {
  final registerCustomOpsLibraryFn =
      RegisterCustomOpsLibrary.asFunction<
        Pointer<OrtStatus> Function(
          Pointer<OrtSessionOptions>,
          Pointer<Char>,
          Pointer<Pointer<Void>> libraryHandle,
        )
      >();
  final status = registerCustomOpsLibraryFn(
    options,
    libraryPath,
    libraryHandle,
  );
  if (status.isError) {
    final error =
        'Register custom ops library failed. Code: ${getErrorCodeMessage(status)}\n'
        'Message: ${consumeErrorMessage(status)}';
    throw Exception(error);
  }
  return status;
}