SafeArrayGetLBound function oleaut32

int SafeArrayGetLBound(
  1. Pointer<SAFEARRAY> psa,
  2. int nDim
)

Gets the lower bound for any dimension of the specified safe array.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/oleauto/nf-oleauto-safearraygetlbound.

Implementation

int SafeArrayGetLBound(Pointer<SAFEARRAY> psa, int nDim) {
  final plLbound = adaptiveCalloc<Int32>();
  final hr$ = HRESULT(_SafeArrayGetLBound(psa, nDim, plLbound));
  if (hr$.isError) {
    free(plLbound);
    throw WindowsException(hr$);
  }
  final result$ = plLbound.value;
  free(plLbound);
  return result$;
}