//
archives

SAFEARRAYs

This category contains 10 posts

Passing a Reference to a SAFEARRAY as Parameter to a Managed COM Event Handler Part 3.

1. Introduction. 1.1 This blog is the third segment of the series of articles that discusses the problems and workarounds in relation to passing a reference to a SAFEARRAY as parameter to a dispinterface-based event which is fired from an unmanaged COM server to a managed client. 1.2 In part 2, I presented a workaround … Continue reading

Passing a Reference to a SAFEARRAY as Parameter to a Managed COM Event Handler Part 2.

1. Introduction. 1.1 This article is a follow up to my earlier blog which outlined the problems with passing a reference to a SAFEARRAY as parameter to a dispinterface-based event which is fired from an unmanaged COM server to a managed client. 1.2 Through this article and the next one to follow, I will demonstrate … Continue reading

Passing a Reference to a SAFEARRAY as Parameter to a Managed COM Event Handler Part 1.

1. Introduction 1.1 I recently ran into an unexpected problem with the .NET CLR. 1.2 It appears that its internal internal mechanism for processing COM events inadequately handles reference SAFEARRAYs passed as event parameters. 1.3 In this blog, I will demonstrate the problem with sample codes. It is my hope that interested readers will research … Continue reading

Marshaling a SAFEARRAY of Managed Structures by P/Invoke Part 7.

1. Introduction. 1.1 We have reached the most complex part of this series of articles on the use of SAFEARRAY to marshal arrays of managed structures between managed and unmanaged code. 1.2 I do hope that I have maintained the reader’s interest up to this point. 1.3 In the first 3 parts of this series, we … Continue reading

Marshaling a SAFEARRAY of Managed Structures by P/Invoke Part 6.

1. Introduction. 1.1 Starting from part 4 I have started to discuss how to interop marshal a managed array of TestStructure structs that is contained within a structure. 1.2 We have seen in part 4 an example for marshaling such a container structure to unmanaged code “one way” (i.e. as an “in” parameter). 1.3 In part … Continue reading

Marshaling a SAFEARRAY of Managed Structures by P/Invoke Part 5.

1. Introduction. 1.1 In part 4, I have started to discuss how to interop marshal a managed array that is contained within a structure. 1.2 I have given a specific working example for marshaling such a container structure to unmanaged code “one way” (i.e. as an “in” parameter). 1.3 Here in part 5, I shall demonstrate how to … Continue reading

Marshaling a SAFEARRAY of Managed Structures by P/Invoke Part 4.

1. Introduction. 1.1 In parts 1 through 3 of this series of articles, I have thoroughly discussed the techniques for exchanging arrays between managed and unmanaged code by way of SAFEARRAYs. 1.2 The knowledge that can be gained from the first 3 parts of this series is sufficient for general development purposes. 1.3 From part 4 … Continue reading

Marshaling a SAFEARRAY of Managed Structures by P/Invoke Part 3.

1. Introduction. 1.1 In part 1 of this series of articles, I demonstrated how to transfer managed arrays to unmanaged code as SAFEARRAYs. The transfer was single-directional “into” the unmanaged function and the SAFEARRAY that was passed to the unmanaged function is treated as “read-only”. 1.2 Then in part 2, I showed how to return a SAFEARRAY from … Continue reading

Marshaling a SAFEARRAY of Managed Structures by P/Invoke Part 2.

1. Introduction. 1.1 In part 1 of this series of articles, I explained how managed arrays may be transferred to unmanaged code as a SAFEARRAY. 1.2 In part 1, the SAFEARRAY was passed to unmanaged code as an “in” (read-only) parameter. 1.3 Here in part 2, I shall continue the discussion this time with the aim of … Continue reading

Marshaling a SAFEARRAY of Managed Structures by P/Invoke Part 1.

1. Introduction. 1.1 I have previously written about exchanging SAFEARRAYs of managed structures with unmanaged code via COM interop. 1.2 In this new series of articles, I shall expound on the exchange of such SAFEARRAYs via P/Invoke. 1.3 I have arranged this series of articles into multiple parts. In the first 3 parts, I shall show … Continue reading

Advertisements