还是VB.NET和C之间的内存地址出错的问题,有请各位神仙
short _stdcall A(void *src, ulint srclen, void *dst, ulint *dstlen)
{
char addr[256];
memset( addr, "\0", sizeof(addr));
sprintf( addr, "Src:%ld, Len:%d, Dst:%ld, dstLen:%ld\n", src, srclen, dst, dstlen);
MessageBox( NULL, addr, "", MB_OK);
.....
}
前2个参数IN,后2个OUT
VB中声明:
Declare Function A Lib "*.dll" (ByVal srcStr As IntPtr, ByVal srcLength As Long, ByVal dstStr As IntPtr, ByVal dstLength As IntPtr) As Short
Dim bufAddr As IntPtr = Marshal.AllocHGlobal(deLength)'delength长度,可以计算出来
Marshal.Copy(debuf, 0, bufAddr, deLength)'debuf是个数组,有值的
Dim dtPtr As IntPtr = Marshal.AllocHGlobal(filesize)
Marshal.Copy(debuf, 0, dtPtr, deLength)
Dim getl As IntPtr = Marshal.AllocHGlobal(4)
A(bufAddr, deLength, dtPtr, getl)调进去后,,,bufaddr的内存地址在DLLMESSAGEBOX中弹出来显示正确,,delength长度也是对的,第三个dtPtr的地址在DLL弹出的MSG框中中显示是0,而msg框中显示第四个的地址却刚好是dtPtr的..........,
怎么解决,请教各位神仙,,,急,请帮忙解决