再问VC,VB混合编程,Dll的数组(指针)传值问题,如:
VC中的代码
extern "C" void   _stdcall  EXPORT Test(double arr[],int n,double *sum)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
    int i;
for(i=0;i<n;i++)
{
*sum+=arr[i];
}
    
}
VB中代码
Declare Function Test Lib "D:\在编程序\VB调MFCDLL\BasicMathLib.dll" (ByRef inputer() As Double, ByVal n As Integer, ByRef sum As Double) As LongPrivate Sub Command2_Click()Dim a(4) As Double
Dim i As Integer
For i = 0 To 4
      a(i) = i
NextDim dsum As Double
Dim result As LongCall Test(a, 5, dsum)
MsgBox dsum
End Sub