By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,141 Members | 1,254 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,141 IT Pros & Developers. It's quick & easy.

Pass array from unmanaged to managed

P: n/a
How can I pass an array from an unmanaged function to a managed one

Say I've go

#pragma unmanage
int GetArray(int* return_array) //return number of member

return_array[0] = 1
return_array[1] = 2
return 2

#pragma manage
int thearray __gc[] = new int __gc[2]

...??? Now what??? I can't do GetArray(thearray)
I'm figuring it must be something to do with IntPtr an
probably involves Marshal::Copy at some point, but I can'
see how it's possible to learn how to do this when all the
examples out there are about DLLs that use MarshalA
attribute. How do I do this

Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.