You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Highs.Native 1.7.1 nuget package in a .NET Framework application (pre-.NET Core/5/6/7/8, Windows only), a PInvokeStackImbalance exception is raised when calling methods such as passLp and readModel.
In highs_csharp_api.cs, all native methods are decorated as follows: [DllImport(highslibname)].
However, as described here: The default value for the CallingConvention field is Winapi, which in turn defaults to StdCall convention on Windows, and Cdecl on all other platforms.
When using the Highs.Native 1.7.1 nuget package in a .NET Framework application (pre-.NET Core/5/6/7/8, Windows only), a PInvokeStackImbalance exception is raised when calling methods such as
passLp
andreadModel
.In highs_csharp_api.cs, all native methods are decorated as follows:
[DllImport(highslibname)]
.However, as described here:
The default value for the CallingConvention field is Winapi, which in turn defaults to StdCall convention on Windows, and Cdecl on all other platforms.
On later versions like .NET 8 on Windows, the exception does not occur because it seems to be no longer implemented (see https://learn.microsoft.com/en-us/dotnet/framework/debug-trace-profile/pinvokestackimbalance-mda), but the problem may still cause applications to become unstable.
Could the DllImport-attribute receive an explicit
CallingConvention.Cdecl
to be compatible with all platforms and target frameworks?The text was updated successfully, but these errors were encountered: