Have a problem while create DLL!!!Need Help
I create a DLL in VC++, call VD.DLL, and include file VD.CPP, its contain:
int _stdcall VD(int *index)
{
int i;
for(i=0;i<5;i++)
index[i] = i;
return (i);
}
In VB6.0, i declare to use this DLL:
Private Declare Function VD "my-dll-path" (ByRef intIndex as integer) as Integer
And use this function in VB's body like this:
Dim intIndex(0 to 50) as Integer //Global Integer Array
Sub VD()
Dim i as integer, intI as Integer
intI = VD(intIndex)
for i=0 to intI-1
MsgBox "Value " & i & " = " & intIndex(i)
Next
End Sub
And It shows :
Value 0 = 0
Value 1 = 0
Value 2 = 1
Value 3 = 0
Value 4 = 2
Those Bold line is not correct. Because in my case, i must show:
Value 0 = 0
Value 1 = 1
Value 2 = 1
Value 3 = 3
Value 4 = 4
Why this happen? Anything wrong in my code?
Thanks
|