I run understanding code in my bridge program to call the double dummy solver dds.dll.
After filling in the variables, the double dummy solver is called by:
calldll = SolveBoard(deal Str, target, solutions, mode, futureStr)
With a 32-bits machine this code is functioning correct, but with a 64-bit machine the code generates next error code:
System.TypeLoad Exception:
Could not load type 'Dealstruct' from assembly B-Bridge version 1.1.7, Culture=neutral , PublicKeyToken= null' because an object field at offset 20 that is incorrectly aligned or overlapped by a non-object field.
Does anyone know which adjustments I have to make to the code so it will function correctly on 64-bit machine.
Code:
<DllImport("dds.dll", CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function SolveBoard(ByVal deal As dealstruct, ByVal target As Integer, ByVal solutions As Integer, ByVal mode As Integer, ByRef tricks As futureTricks) As Integer
End Function
<StructLayout(LayoutKind.Explicit)> _
Public Structure dealstruct
<FieldOffset(0)> Public trump As Integer
<FieldOffset(4)> Public first As Integer
<MarshalAs(UnmanagedType.ByValArray, sizeconst:=3)> _
<FieldOffset(8)> Public currentTrickSuit() As Integer
<MarshalAs(UnmanagedType.ByValArray, sizeconst:=3)> _
<FieldOffset(20)> Public currentTrickRank() As Integer
<MarshalAs(UnmanagedType.ByValArray, sizeconst:=16)> _
<FieldOffset(32)> Public remainCards(,) As Integer
End Structure
Public Structure futureTricks
<FieldOffset(0)> Public nodes As Integer
<FieldOffset(4)> Public cards As Integer
<MarshalAs(UnmanagedType.ByValArray, sizeconst:=13)> _
<FieldOffset(8)> Public suit() As Integer
<MarshalAs(UnmanagedType.ByValArray, sizeconst:=13)> _
<FieldOffset(12)> Public rank() As Integer
<MarshalAs(UnmanagedType.ByValArray, sizeconst:=13)> _
<FieldOffset(16)> Public Shadows equals() As Integer
<MarshalAs(UnmanagedType.ByValArray, sizeconst:=13)> _
<FieldOffset(20)> Public score() As Integer
End Structure
Public dealStr As New dealstruct
Public futureStr As New futureTricks
Public Sub Initialize()
ReDim dealStr.currentTrickSuit(2)
ReDim dealStr.currentTrickRank(2)
ReDim dealStr.remainCards(3, 3)
ReDim futureStr.suit(12)
ReDim futureStr.rank(12)
ReDim futureStr.equals(12)
ReDim futureStr.score(12)
End Sub
calldll = SolveBoard(deal Str, target, solutions, mode, futureStr)
With a 32-bits machine this code is functioning correct, but with a 64-bit machine the code generates next error code:
System.TypeLoad Exception:
Could not load type 'Dealstruct' from assembly B-Bridge version 1.1.7, Culture=neutral , PublicKeyToken= null' because an object field at offset 20 that is incorrectly aligned or overlapped by a non-object field.
Does anyone know which adjustments I have to make to the code so it will function correctly on 64-bit machine.
Comment