Public Declare Function Trial Lib "imprffunctions" (ByRef BeamWidth() As Double, ByVal x As Integer, ByVal y As Integer) As Double
Private BeamWidthList(359, 2) As DoubleSub T()
Dim i As Integer
Dim j As Integer
Dim ary(359, 2) As Double
IniBw '初始化BeamWidthList数组
For i = 0 To 359
For j = 0 To 2
ary(i, j) = Trial(BeamWidthList, i, j)
Next
NextEnd SubSub IniBw()
'初始化BeamwidthList表
Dim i As Integer
With ThisWorkbook.Sheets("BeamWidth")
For i = 0 To 359
BeamWidthList(i, 0) = .Cells(i + 2, 2).Value '360
BeamWidthList(i, 1) = .Cells(i + 2, 6).Value '60
BeamWidthList(i, 2) = .Cells(i + 2, 17).Value '9
Next
End With
End Sub用VC封装的DLL部分,封装的其他函数都可以用,就是下面这个测试函数,使用了指针,总是出错###############double EXPORT _stdcall Trial(double (*beamwidth)[3],int x, int y)
{
return *(*(beamwidth+x)+y);
}运行到上面红色的部分EXCEL就会出错,不知道哪儿出错,应该在封装的部分想问一下,VBA怎么向VC封装的DLL传递数组?谢谢了先。
难道VC中的内存地址和VB中的不一样?
因为我在VC中传递过都没问题