-
April 27th, 2011, 12:22 AM
#1
Marshalling integer array
Hi,
I would like to implement following design in C++ and C Sharp. Please help me performing marshaling between CPP and COM module.
CPP:
function_cpp()
{
int a[10]
int *p;
CComPtr<IDotNetInterface> pI;
pl->function_com(&p);
for (int i = 0; i < 10; i++)
a[i] = p[i];
}
CSharp COM module:
function_com([MarshalAs(UnmanagedType.LPArray, SizeConst = 10, ArraySubType = UnmanagedType.I4)] out int[] arrayVar)
{
arrayVar = new int[10];
for (int i = 0; i<10; i++)
arrayVar[i]=i;
}
Compilation of COM module is successful. But build of CPP module fails with error "error C2664: 'IDotNetInterface::function_com' : cannot convert parameter from 'int **__w64 ' to 'long **'"
Please hemp me in performing correct marshaling.
Thanks
Anand
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|