//
archives

Archive for

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