node-ctypes - v2.10.0
    Preparing search index...

    Class OleDLL

    Load a Windows library whose functions return HRESULT. Any function with restype = HRESULT is automatically wrapped so that a negative return value throws an Error with .hresult / .winerror attached.

    Python equivalent: ctypes.OleDLL

    import { OleDLL, HRESULT, c_wchar_p, c_void_p } from 'node-ctypes';

    const ole32 = new OleDLL('ole32.dll');
    const CLSIDFromString = ole32.func('CLSIDFromString', HRESULT, [c_wchar_p, c_void_p]);
    // Throws automatically on HRESULT < 0
    CLSIDFromString('{00000000-0000-0000-0000-000000000000}', Buffer.alloc(16));

    Hierarchy (View Summary)

    Indexable

    • [funcName: string]: any

      Python-like function access. Accessing any property returns a FunctionWrapper that supports argtypes/restype assignment.

    Index
    path: string

    Library file path.

    loaded: boolean

    Whether the logical handle is open, independently of physical module residency.

    • Get the address of a symbol.

      Parameters

      • name: string

        Symbol name

      Returns bigint

      Address as BigInt

    • Close the library and clear the function cache. Functions obtained from it throw when called afterwards. Throws while a call to one of its functions is in progress (from a callback, or a pending callAsync()). Existing in_dll() views defer native handle release until their dependent memory is collected, but new calls and symbol lookups are rejected. Physical unloading depends on the OS loader; musl keeps modules resident.

      Returns void

    • Read the snapshotted GetLastError() (Windows) or errno from the most recent call on this library. Requires use_last_error: true at construction.

      Python ctypes parity: ctypes.get_last_error() (library-scoped variant).

      Returns number

    • Read the snapshotted errno from the most recent call on this library. Requires use_errno: true at construction.

      Python ctypes parity: ctypes.get_errno() (library-scoped variant).

      Returns number