Suppose we create an array within some managed .NET code, e.g. C#
int[] myData = new int[10];
And suppose we have a COM component with the following interface method [as defined within an IDL file]:
HRESULT SetData([in] VARIANT* pData);
Now suppose from with in the managed code we call this COM component's SetData method:
object data = myData
COMComponent.SetData(ref data);
Is there a way to pass a handle to the managed myData to the unmanaged COM component, via Interop, without copying the data? I.e. is there a way the COM component can directly reference the managed memory? Is there a way of safely allowing the COM component to keep a reference to the data, for future access? The COM component would not modify the values in this array, i.e. it would purely be for read only access.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.