Reputation: 16121
I am trying to call the method with the following declaration:
extern "C" __declspec(dllimport) int __stdcall CalcDDtable(struct ddTableDeal tableDeal, struct ddTableResults * tablep);
The structs are defined thus:
struct ddTableDeal {
unsigned int cards[4][4];
};
struct ddTableResults {
int resTable[5][4];
};
I am trying to call it thus:
<DllImport("dds.dll", CallingConvention:=CallingConvention.StdCall)>
Public Shared Function CalcDDtable(ByVal deal As TableDeal, ByRef results As TableResults) As Integer
End Function
Public Function CalculateDeal() As Integer
Dim tableDeal As TableDeal
Dim tableResults As TableResults
Dim cards(3, 3) As Integer
cards(0, 0) = 32764
cards(1, 1) = 32764
cards(2, 2) = 32764
cards(3, 3) = 32764
tableDeal.Cards = cards
Dim results(4, 3) As Integer
tableResults=new TableResults
tableResults.Results = results
Dim errorCode = CalcDDtable(tableDeal, tableResults)
Return errorCode
End Function
End Class
Public Structure TableDeal
Dim Cards(,) As Integer
End Structure
Public Structure TableResults
Dim Results(,) As Integer
End Structure
The structs should both be twodimensional arrays with indexes of 4,4 and 5,4 respectively. The second one is an out parameter.
Where am I going wrong?
For those who want to know:this is the double dummy solver .dll written by Bo Haglund
Upvotes: 2
Views: 952