Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Make the Native Simulator API More Reusable and Reuse it in Runtime #592

@kuzminrobin

Description

@kuzminrobin

The Native Simulator has the Dump call with the following declaration:

MICROSOFT_QUANTUM_DECL void Dump(_In_ unsigned sid, _In_ bool (*callback)(size_t, double, double));

Its second parameter's type is defined in-place, which prevents its reuse in the calling code in Runtime. The calling code has to re-define that type:

typedef bool (*TGetStateCallback)(size_t /*basis vector*/, double /* amplitude Re*/, double /* amplitude Im*/);

Also the Native Simulator is compiled into the dynamic library that exposes its API in the header capi.hpp, but the Runtime does not include that header. That is why the calling code in the Runtime re-declares all the Native Simulator's API function signatures, e.g. the Dump() call signature is re-declared like this:

typedef bool (*TDump)(unsigned, TGetStateCallback);

(pay attention to the return type bool as opposed to the actual return type void in the first-most listing above).
To avoid re-declaration, start including the capi.hpp in the Runtime.

See also #631.

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenanceImprove codebase quality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions