diff --git a/src/Qir/Runtime/lib/Simulators/FullstateSimulator.cpp b/src/Qir/Runtime/lib/Simulators/FullstateSimulator.cpp index e242cfec42d..8724a7b6a3a 100644 --- a/src/Qir/Runtime/lib/Simulators/FullstateSimulator.cpp +++ b/src/Qir/Runtime/lib/Simulators/FullstateSimulator.cpp @@ -29,12 +29,11 @@ typedef void* QUANTUM_SIMULATOR; namespace { -#ifdef _WIN32 const char* FULLSTATESIMULATORLIB = "Microsoft.Quantum.Simulator.Runtime.dll"; -#elif __APPLE__ -const char* FULLSTATESIMULATORLIB = "libMicrosoft.Quantum.Simulator.Runtime.dylib"; -#else -const char* FULLSTATESIMULATORLIB = "libMicrosoft.Quantum.Simulator.Runtime.so"; +#if defined(__APPLE__) +const char* XPLATFULLSTATESIMULATORLIB = "libMicrosoft.Quantum.Simulator.Runtime.dylib"; +#elif !defined(_WIN32) +const char* XPLATFULLSTATESIMULATORLIB = "libMicrosoft.Quantum.Simulator.Runtime.so"; #endif QUANTUM_SIMULATOR LoadQuantumSimulator() @@ -52,8 +51,12 @@ QUANTUM_SIMULATOR LoadQuantumSimulator() handle = ::dlopen(FULLSTATESIMULATORLIB, RTLD_LAZY); if (handle == nullptr) { - throw std::runtime_error( - std::string("Failed to load ") + FULLSTATESIMULATORLIB + " (" + ::dlerror() + ")"); + handle = ::dlopen(XPLATFULLSTATESIMULATORLIB, RTLD_LAZY); + if (handle == nullptr) + { + throw std::runtime_error( + std::string("Failed to load ") + XPLATFULLSTATESIMULATORLIB + " (" + ::dlerror() + ")"); + } } #endif return handle;