Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7242 Discussions

cblas_daxpy crashes in MKL 2025.2 when called from C++/CLI code targeting .NET Core

Jones__Andrew
Beginner
2,711 Views

cblas_daxpy fails (crashes to desktop) when called from C++/CLI code that targets .NET Core (or related targets, such as .NET 8). It works properly when called from native C++ code, or C++/CLI code that targets .NET Framework.

The following C++/CLI code can be used to reproduce the problem:

cli::array<double>^ x = gcnew cli::array<double>(3);
x[0] = -1.0; x[1] = 2.0; x[2] = -1.5;
cli::array<double>^ y = gcnew cli::array<double>(3);
y[0] = 2.5; y[1] = -3.0; y[2] = 4.0;
pin_ptr<double> px = &x[0];
pin_ptr<double> py = &y[0];
cblas_daxpy(3, 2.0, px, 1, py, 1);
Console::WriteLine("{0}\t{1}\t{2}", y[0], y[1], y[2]);

Console applications exit with code -1073740791 (0xc0000409), and desktop applications crash without raising an exception.

The attached Zip file contains the following projects:

  • TestDAXPYNativeCPP - native C++ console application (works)
  • TestDAXPYNetFxCPP - C++/CLI console application targeting .NET Framework 4.8 (works)
  • TestDAXPYNetCoreCPPDLL and TestDAXPYNetCoreCS - C++/CLI class library (DLL) and C# console application targeting .NET 5 (C++/CLI does not support .NET Core console applications, so the C# app calls the C++/CLI DLL) (crashes)

Note that the code has been tested with multiple versions of Microsoft C++ compiler, and was working properly with Math Kernel Library versions 2025.1 and earlier.

0 Kudos
2 Replies
Yang76
Novice
1,603 Views

I have the same issue. I also have the similar error with cblas_dsymv.

0 Kudos
Fengrui
Moderator
1,166 Views

Thank you for reporting this issue!

It has been fixed and the fix will be included in the oneMKL 2025.3 release.

0 Kudos
Reply