S
Steve Baer
I'm wrapping some unmanaged C++ classes with managed versions for use in the
..NET world. Everything is going great except I can't figure out a good
method for passing simple data type arrays into unmanaged classes.
Say I have a function
void UnManagedClass::FillOutArray(int size, int* data);
where data is an array of unmanaged ints and size gives the size of the
array.
I would like to wrap the function like so
void ManagedClass::FillOutArray(int __gc* data[])
{
int size = data->Length;
int __pin* pUnMgdData= (some way to pin the data array???)
m_internalPtr ->FillOutArray(size, pUnMgdData); //pointer to internal
instance of unmanaged class
}
I know I could create an array of ints in the function and then copy the
values to the data array after the internal unmanaged call, but I was hoping
there would be a slicker way.
Any help would be greatly appreciated. Thanks in advance,
-steve
..NET world. Everything is going great except I can't figure out a good
method for passing simple data type arrays into unmanaged classes.
Say I have a function
void UnManagedClass::FillOutArray(int size, int* data);
where data is an array of unmanaged ints and size gives the size of the
array.
I would like to wrap the function like so
void ManagedClass::FillOutArray(int __gc* data[])
{
int size = data->Length;
int __pin* pUnMgdData= (some way to pin the data array???)
m_internalPtr ->FillOutArray(size, pUnMgdData); //pointer to internal
instance of unmanaged class
}
I know I could create an array of ints in the function and then copy the
values to the data array after the internal unmanaged call, but I was hoping
there would be a slicker way.
Any help would be greatly appreciated. Thanks in advance,
-steve