.NET is cross-platform but DDS_Core will not build as-is on Mac or Linux for several reasons:
- The target is set to x64
- The solution for building a native library is specific to Visual Studio which only runs on Windows
I made some experimental changes as follows:
- Added a shared library to the root BUILD_bazel. I don't know what I am doing here but I loaded the rule "cc_shared_library" and added a target:
cc_shared_library(
name = "dds_shared",
deps = ["//library/src:dds"],
visibility = ["//visibility:public"],
)
(I don't like the name dds_shared but it was just an experiment).
This worked - I am on a Mac and the library turned up in bazel-bin as libdds_shared.dylib
-
Modified DDS_Core.csproj to remove the Platforms element which specified x64
-
Modified DDS_Core.csproj to copy my shared library from bazel-bin to the output
-
Changed the target framework to .NET 10 because why not?
-
Modified DDS_Core.slnx to remove the references to dds_native.vcxproj and the x64 references.
-
Removed the Platforms element in DDS_Core_Demo.csproj and also changed the target framework to .NET 10
-
Modified DdsNative.cs to use "dds_shared"
I could now build both DDS_Core and DDS_Core_Demo on the Mac with dotnet build.
I get the following output from DDS_Core_Demo, looks OK apart from "Error: Wrong number of remaining cards in a hand"? Update: Looks like the error message is deliberate.
Validating TestData...
SolveBoard
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
SolveBoard PBN
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
SolveAllBoards
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
SolveAllBoards PBN
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcDdTable
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcDdTable PBN
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcAllTables
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcAllTables PBN
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcPar
[NS:EW 5Dx],[EW:EW 5Dx]
[NS 500],[EW -500]
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcPar PBN
[NS:EW 5Dx],[EW:EW 5Dx]
[NS 500],[EW -500]
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
Par
[NS:EW 5Dx],[EW:EW 5Dx]
[NS 500],[EW -500]
ParDealer
1
500
[5D*-EW-3],[],[],[],[],[],[],[],[],[]
DealerParBothSides
1
500
EW:5C(-3)
ParAll -> ParResultsMasters
Side N/S
1
500
5C(-3)
Side E/W
1
-500
5C(-3)
ParSide -> ParResultsDealers
1
500
[5D*-EW-3],[],[],[],[],[],[],[],[],[]
1
-500
[5D*-EW-3],[],[],[],[],[],[],[],[],[]
ConvertToTextFormat ParResultsMaster
Par 500: EW 5Dx-3
ConvertToTextFormat ParResultsMasters
[Par 500: EW 5Dx-3],[Par -500:EW 5Dx-3]
AnalysePlay PlayTracesBin
0: 3
1: 3
2: 3
3: 4
AnalysePlay PlayTracePBN
0: 3
1: 3
2: 3
3: 4
AnalysePlay PlayTracesBin
AnalyseAllPlay PlayTracesPBN
0: 3
1: 3
2: 3
3: 4
GetDDSInfo
DDS Info:
Version: 3.0.0
System: 4
Bits: 64
Threading: 0
Threads: 1
Error Message
Error: Wrong number of remaining cards in a hand
SolveBoard v3
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcDdTable V3
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcDdTable PBN V3
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcPar V3
[NS:EW 5Dx],[EW:EW 5Dx]
[NS 500],[EW -500]
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
.NET is cross-platform but DDS_Core will not build as-is on Mac or Linux for several reasons:
I made some experimental changes as follows:
cc_shared_library(
name = "dds_shared",
deps = ["//library/src:dds"],
visibility = ["//visibility:public"],
)
(I don't like the name dds_shared but it was just an experiment).
This worked - I am on a Mac and the library turned up in bazel-bin as libdds_shared.dylib
Modified DDS_Core.csproj to remove the Platforms element which specified x64
Modified DDS_Core.csproj to copy my shared library from bazel-bin to the output
Changed the target framework to .NET 10 because why not?
Modified DDS_Core.slnx to remove the references to dds_native.vcxproj and the x64 references.
Removed the Platforms element in DDS_Core_Demo.csproj and also changed the target framework to .NET 10
Modified DdsNative.cs to use "dds_shared"
I could now build both DDS_Core and DDS_Core_Demo on the Mac with dotnet build.
I get the following output from DDS_Core_Demo, looks OK apart from "Error: Wrong number of remaining cards in a hand"? Update: Looks like the error message is deliberate.
Validating TestData...
SolveBoard
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
SolveBoard PBN
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
SolveAllBoards
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
SolveAllBoards PBN
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcDdTable
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcDdTable PBN
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcAllTables
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcAllTables PBN
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcPar
[NS:EW 5Dx],[EW:EW 5Dx]
[NS 500],[EW -500]
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcPar PBN
[NS:EW 5Dx],[EW:EW 5Dx]
[NS 500],[EW -500]
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
Par
[NS:EW 5Dx],[EW:EW 5Dx]
[NS 500],[EW -500]
ParDealer
1
500
[5D*-EW-3],[],[],[],[],[],[],[],[],[]
DealerParBothSides
1
500
EW:5C(-3)
ParAll -> ParResultsMasters
Side N/S
1
500
5C(-3)
Side E/W
1
-500
5C(-3)
ParSide -> ParResultsDealers
1
500
[5D*-EW-3],[],[],[],[],[],[],[],[],[]
1
-500
[5D*-EW-3],[],[],[],[],[],[],[],[],[]
ConvertToTextFormat ParResultsMaster
Par 500: EW 5Dx-3
ConvertToTextFormat ParResultsMasters
[Par 500: EW 5Dx-3],[Par -500:EW 5Dx-3]
AnalysePlay PlayTracesBin
0: 3
1: 3
2: 3
3: 4
AnalysePlay PlayTracePBN
0: 3
1: 3
2: 3
3: 4
AnalysePlay PlayTracesBin
AnalyseAllPlay PlayTracesPBN
0: 3
1: 3
2: 3
3: 4
GetDDSInfo
DDS Info:
Version: 3.0.0
System: 4
Bits: 64
Threading: 0
Threads: 1
Error Message
Error: Wrong number of remaining cards in a hand
SolveBoard v3
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcDdTable V3
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcDdTable PBN V3
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5
CalcPar V3
[NS:EW 5Dx],[EW:EW 5Dx]
[NS 500],[EW -500]
N E S W
__ __ __ __
Tricks in spades : 6 6 6 6
Tricks in hearts : 10 3 10 3
Tricks in diamonds : 5 8 5 8
Tricks in clubs : 6 7 6 7
Tricks in no trump : 6 5 6 5