Skip to content

Fix of issue: Address dotnet issues identified by Cursor #182#184

Open
mortensp wants to merge 5 commits into
dds-bridge:developfrom
mortensp:feature_dotnet_wrapper
Open

Fix of issue: Address dotnet issues identified by Cursor #182#184
mortensp wants to merge 5 commits into
dds-bridge:developfrom
mortensp:feature_dotnet_wrapper

Conversation

@mortensp

@mortensp mortensp commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

I have made the following fixes:

  • the calc_par are now exported through a dds_calc_table wrapper function in dds_api.cpp. This ensures proper C linkage and avoids name‑mangling issues. The two other calc_... exports are also prefixed dds_
  • calc_par_from_table does not have a modern SolverContext‑based variant, which is why it is not included in the .NET wrapper for DDS. So no change here.
  • One FreeMemory() call changed to ctx.ResetForSolve();
  • Broken XML doc fixed
  • ThrowIfError are marked [Conditional("DEBUG")] so it isn't called in release compiles.
  • CalcDdTable are now named correctly in ThowIfError call
  • Spurious using directives removed

Closes #182
Closes #184

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses .NET interop and wrapper issues by standardizing exported native entry points (avoiding C++ name mangling), updating P/Invoke declarations to match, and cleaning up .NET XML docs and debug-only error throwing behavior.

Changes:

  • Rename/standardize v3 native exports to dds_* names and add a C-linkage wrapper export for calc_par.
  • Update .NET P/Invoke and managed wrappers to call the new native entry points; make ThrowIfError debug-only via [Conditional("DEBUG")].
  • Fix XML docs and remove spurious/unused using directives in .NET projects.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
library/src/dds_api.cpp Adds/renames exported wrapper functions (dds_calc_dd_table*, dds_calc_par) for stable interop symbols.
library/src/api/dds_api.hpp Updates exported function declarations to dds_* names and adds dds_calc_par.
library/src/api/calc_par.hpp Removes an inconsistent DLLEXPORT on the C++ overload declaration.
dotnet/DDS_Core/Native/DdsNative.cs Updates DllImport declarations to call the new dds_* native exports; removes unused usings.
dotnet/DDS_Core/Helpers/SolverContextHandle.cs Cleans unused usings; keeps SafeHandle-based lifetime management.
dotnet/DDS_Core/DDS.cs Fixes XML doc issues, makes ThrowIfError debug-only, and adjusts parameter ordering in managed APIs.
dotnet/DDS_Core/DataModel/SolverContext.cs Updates to new dds_* P/Invoke names and makes ThrowIfError debug-only.
dotnet/DDS_Core_Demo/Program.cs Updates demo usage and adds a v3 CalcPar sample invocation.

Comment thread dotnet/DDS_Core_Demo/Program.cs Outdated
Comment thread dotnet/DDS_Core_Demo/Program.cs Outdated
Comment thread dotnet/DDS_Core/DDS.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Address dotnet issues identified by Cursor

2 participants