在VB中将函数申明修改为
Private Declare Function csz Lib "testdll.dll" (d As Byte, ByVal n As Integer) As Integer
调用时
Dim bT() as Byte
if csz(bT(0))<>0 then
Private Declare Function csz Lib "testdll.dll" (d As Byte, ByVal n As Integer) As Integer
调用时
Dim bT() as Byte
if csz(bT(0))<>0 then
(这是相对于C的按行排列,因为行与列都是人为定义的)。
1.Preserve
Preserves the data in an existing array when you change the size of the last dimension
最后一维可以改变尺寸。
通过数据库的表的联想,一般操作是加减记录(行),而不是改变列。
这说明最后一维就是行。
2.How Visual Basic 4.0 Calls C and Fortran DLLs(Knowledge base)
其中的例子是中CDLL.C的一段代码.
void FunctionTypeModifier PassDblArrToC( double arr[7][3] )
{
/* Notice that the first 2 dimensions are reversed from what is declared
in VB.
*/
int i, j;
for ( i=0; i<3; i++ ) /* 0 <= i <= 2 */
for ( j=0; j<7; j++ ) /* 0 <= j <= 6 */
arr[j][i] = 20.0*i + 0.1*j;
}通过上面两点,我的问题已解决。