Feature dotnet wrapper#176
Open
mortensp wants to merge 18 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new .NET wrapper layer (DDS_Core) over the DDS native engine, adds a demo application, and wires up Visual Studio projects to produce a dds_native DLL intended for P/Invoke consumption. It also updates the public C++ headers to expose additional context-aware entry points and adds documentation for the new .NET interface.
Changes:
- Add a new native DLL project (
dds_native) and a new C-export wrapper header intended for .NET P/Invoke. - Add
DDS_Core(.NET 8) plusDDS_Core_Demowith typed interop models and example usage. - Update solution/VS project output paths and add docs/README links for the .NET interface.
Reviewed changes
Copilot reviewed 94 out of 95 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| solution/solve_board.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/solve_board_pbn.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/solve_all_boards.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/Solution.slnx | Adds dds_native project and build dependencies. |
| solution/par.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/migration_example.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/hands.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/dealer_par.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/DDS.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/dds_native.vcxproj.filters | Adds VS filter mapping for native DLL project sources/headers. |
| solution/dds_native.vcxproj | Adds native DLL project that compiles DDS sources into dds_native. |
| solution/calc_par_context_example.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/calc_dd_table.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/calc_all_tables.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/calc_all_tables_pbn.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/analyse_play_pbn.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/analyse_play_bin.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| solution/analyse_all_plays_bin.vcxproj | Removes explicit props import; updates OutDir/IntDir paths. |
| README.md | Adds link to the new .NET interface documentation. |
| library/src/solver_context/solver_context.cpp | Minor comment change near includes/ctor initializer list. |
| library/src/api/dds_api.hpp | Adds new C-export wrapper surface intended for .NET interop. |
| library/src/api/calc_par.hpp | Updates context-aware calc_par declaration with export/linkage macros. |
| library/src/api/calc_dd_table.hpp | Updates context-aware calc_dd_table* declarations with export/linkage macros. |
| library/src/api/BUILD.bazel | Adds dds_api.hpp to the API Bazel target headers. |
| dotnet/Directory.Build.props | Adds shared MSBuild properties for .NET projects (output paths, warnings, etc.). |
| dotnet/DDS_Core/Properties/launchSettings.json | Enables mixed managed/native debugging for DDS_Core. |
| dotnet/DDS_Core/Native/DdsNative.cs | Declares P/Invoke signatures for legacy and new context-based entry points. |
| dotnet/DDS_Core/Helpers/stringArray2xDebugView.cs | Debugger proxy helper for 2-row string buffers. |
| dotnet/DDS_Core/Helpers/stringArray2x16.cs | Fixed-size 2x16 ASCII string buffer for interop. |
| dotnet/DDS_Core/Helpers/stringArray2x128.cs | Fixed-size 2x128 ASCII string buffer for interop. |
| dotnet/DDS_Core/Helpers/stringArray10xDebugView.cs | Debugger proxy helper for 10-row string buffers. |
| dotnet/DDS_Core/Helpers/stringArray10x10.cs | Fixed-size 10x10 ASCII string buffer for interop. |
| dotnet/DDS_Core/Helpers/string80.cs | Fixed-size 80-byte ASCII string buffer for interop. |
| dotnet/DDS_Core/Helpers/string106.cs | Fixed-size 106-byte ASCII string buffer for interop. |
| dotnet/DDS_Core/Helpers/SolverContextHandle.cs | SafeHandle wrapper for the native SolverContext pointer lifetime. |
| dotnet/DDS_Core/Helpers/SolveBoardResultExtensions.cs | Adds error-code-to-message helpers for DDS return codes. |
| dotnet/DDS_Core/Helpers/ResultsTable.cs | Adds a fixed 5x4 int buffer helper type for interop. |
| dotnet/DDS_Core/Helpers/intArray5xDebugView.cs | Debugger proxy helper for 5-row numeric buffers. |
| dotnet/DDS_Core/Helpers/intArray5x4.cs | Fixed-size 5x4 int buffer for interop. |
| dotnet/DDS_Core/Helpers/intArray53.cs | InlineArray wrapper for 53 ints (play-analysis tricks). |
| dotnet/DDS_Core/Helpers/intArray52.cs | InlineArray wrapper for 52 ints (play trace arrays). |
| dotnet/DDS_Core/Helpers/intArray5.cs | InlineArray wrapper for 5 ints. |
| dotnet/DDS_Core/Helpers/intArray3.cs | InlineArray wrapper for 3 ints. |
| dotnet/DDS_Core/Helpers/intArray200.cs | InlineArray wrapper for up to 200 ints (batch operations). |
| dotnet/DDS_Core/Helpers/intArray13.cs | InlineArray wrapper for 13 ints (future tricks arrays). |
| dotnet/DDS_Core/Helpers/IBuffer.cs | Interface used by debug-view helpers for row-to-string conversion. |
| dotnet/DDS_Core/Helpers/Global.cs | Small constant tables for contract formatting output. |
| dotnet/DDS_Core/Helpers/FourHands.cs | Fixed 4x4 uint buffer representing hands/suits card bitmasks. |
| dotnet/DDS_Core/DDS.cs | Main .NET wrapper class exposing legacy API calls + helper utilities. |
| dotnet/DDS_Core/DDS_Core.slnx | Adds a dedicated .NET solution including dds_native dependency. |
| dotnet/DDS_Core/DDS_Core.csproj | Adds .NET 8 library project configuration. |
| dotnet/DDS_Core/DataModel/SolverContext.cs | Managed SolverContext wrapper using SafeHandle and P/Invoke. |
| dotnet/DDS_Core/DataModel/SolverConfig.cs | Managed SolverConfig struct for native config interop. |
| dotnet/DDS_Core/DataModel/SolvedPlays.cs | Interop model for multiple solved play traces. |
| dotnet/DDS_Core/DataModel/SolvedPlay.cs | Interop model for a single solved play trace. |
| dotnet/DDS_Core/DataModel/SolvedBoards.cs | Interop model for multiple solved boards. |
| dotnet/DDS_Core/DataModel/PlayTracesPBN.cs | Interop model for multiple PBN play traces. |
| dotnet/DDS_Core/DataModel/PlayTracesBin.cs | Interop model for multiple binary play traces. |
| dotnet/DDS_Core/DataModel/PlayTracePBN.cs | Interop model for a PBN play trace. |
| dotnet/DDS_Core/DataModel/PlayTraceBin.cs | Interop model for a binary play trace. |
| dotnet/DDS_Core/DataModel/ParTextResults.cs | Interop model for par text results. |
| dotnet/DDS_Core/DataModel/ParResultsMasters.cs | Interop model for multi-side par results (master format). |
| dotnet/DDS_Core/DataModel/ParResultsMaster.cs | Interop model for par results master record and contracts. |
| dotnet/DDS_Core/DataModel/ParResultsDealers.cs | Interop model for dealer-oriented par results for both sides. |
| dotnet/DDS_Core/DataModel/ParResultsDealer.cs | Interop model for dealer par results. |
| dotnet/DDS_Core/DataModel/parResults.cs | Interop model for par scores/contracts strings (2-sided). |
| dotnet/DDS_Core/DataModel/FutureTricks.cs | Interop model for future tricks results. |
| dotnet/DDS_Core/DataModel/Enums and Constants/TTKind.cs | Managed enum mirroring native TT kind selection. |
| dotnet/DDS_Core/DataModel/Enums and Constants/Suit.cs | Managed suit enum. |
| dotnet/DDS_Core/DataModel/Enums and Constants/SolvingMode.cs | Managed solving-mode enum. |
| dotnet/DDS_Core/DataModel/Enums and Constants/SolveBoardResult.cs | Managed DDS return-code enum + docs. |
| dotnet/DDS_Core/DataModel/Enums and Constants/Hand.cs | Managed hand enum. |
| dotnet/DDS_Core/DataModel/Enums and Constants/DdsConstants.cs | Managed constants mirroring DDS limits. |
| dotnet/DDS_Core/DataModel/Enums and Constants/CardRanks.cs | Managed card-rank bitmask enum. |
| dotnet/DDS_Core/DataModel/DealPBN.cs | Interop model for PBN deal input. |
| dotnet/DDS_Core/DataModel/Deal.cs | Interop model for binary deal input. |
| dotnet/DDS_Core/DataModel/DdTablesResult.cs | Interop model for multiple DD-table results with indexing helper. |
| dotnet/DDS_Core/DataModel/ddTableResults.cs | Interop model for one DD-table result. |
| dotnet/DDS_Core/DataModel/DdTableDealsPBN.cs | Interop model for batch PBN DD-table deal inputs. |
| dotnet/DDS_Core/DataModel/DdTableDeals.cs | Interop model for batch binary DD-table deal inputs. |
| dotnet/DDS_Core/DataModel/DdTableDealPBN.cs | Interop model for single PBN DD-table deal input. |
| dotnet/DDS_Core/DataModel/ddTableDeal.cs | Interop model for single binary DD-table deal input. |
| dotnet/DDS_Core/DataModel/DDSInfo.cs | Interop model for library info (GetDDSInfo). |
| dotnet/DDS_Core/DataModel/ContractType.cs | Interop model for contract representation and formatting. |
| dotnet/DDS_Core/DataModel/BoardsPBN.cs | Interop model for batch PBN board solving input. |
| dotnet/DDS_Core/DataModel/Boards.cs | Interop model for batch binary board solving input. |
| dotnet/DDS_Core/DataModel/AllParResults.cs | Interop model for par results across multiple tables. |
| dotnet/DDS_Core/.cr/personal/Navigation/Code Places.xml | Adds IDE/user state file (should typically be excluded). |
| dotnet/DDS_Core_Demo/TestData.cs | Adds demo test data and validation helpers. |
| dotnet/DDS_Core_Demo/Properties/launchSettings.json | Enables mixed managed/native debugging for DDS_Core_Demo. |
| dotnet/DDS_Core_Demo/Program.cs | Adds demo program showcasing API usage + a benchmark mode. |
| dotnet/DDS_Core_Demo/DDS_Core_Demo.csproj | Adds .NET 8 console demo project referencing DDS_Core. |
| docs/dotnet_interface.md | Adds documentation describing the new .NET wrapper API. |
| .gitignore | Ignores additional .NET and IDE output/state directories. |
Comments suppressed due to low confidence (2)
library/src/api/calc_par.hpp:67
- The
SolverContext&overload is now declared withEXTERN_C, which changes it to C linkage and breaks the C++ ABI (symbol name changes) for existing consumers. Since this overload is not callable from C anyway (C++ reference parameter), keep it as normal C++ linkage and expose a separate C wrapper for P/Invoke instead.
dotnet/DDS_Core/Helpers/ResultsTable.cs:59 - This file is missing the final closing
}for theResultsTablestruct, which makes it syntactically invalid C#. Even if the file is currently excluded from compilation, leaving broken source in-repo is risky/confusing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
.Net applications.Note: I have not been able to build using Bazel, so everything has been done i VS.