qsharp-runtime icon indicating copy to clipboard operation
qsharp-runtime copied to clipboard

Fix the Native Simulator to Expose the Fixed-Size Types.

Open kuzminrobin opened this issue 3 years ago • 0 comments

The Native Simulator is compiled (to a dynamic library) with g++ on WSL, and presumably with MSVC++ on Win. Our QIR wrappers around it, e.g. CFullstateSimulator in QIR Runtime, are compiled with a different compiler - clang.

The Native Simulator dynamic library exposes its API using the built-in types like unsigned, bool, double, etc. The size of such types can be different in different compilers, which can cause problems when crossing the dynamic library boundary (see more details here, search for "Datatype size".)

Consider replacing all the built-in types with the fixed-size types, like uint32_t, uint8_t, <to do: fixed-size type for double>. Example of a problem.

See related #630, #592.

kuzminrobin avatar Apr 15 '21 19:04 kuzminrobin