//
archives

CoTaskMemAlloc

This tag is associated with 14 posts

Returning an Array of Strings from C++ to C# Part 2

1. Introduction. 1.1 In part 1 of this series of blogs, I have provided a rigorous low-level technique for transferring an array of C-style strings from an unmanaged C++ API to a managed C# client application. 1.2 Here in part 2, a relatively simpler method (from the point of view of the C# client application) for … Continue reading

Returning an Array of Strings from C++ to C# Part 1

1. Introduction. 1.1 I’ve previously written a blog entry expounding on ways to return a C-style string from C++ unmanaged code to C#. 1.2 Besides those that return a single string, APIs that return an array of strings are also never short in demand. 1.3 In this 2-part series of blogs I shall be discussing ways … Continue reading

Interoping COM Structures.

1. Introduction. 1.1 COM structures, or User-Defined Types (UDTs) are very useful constructs. Their interoperability in managed code, however, is not perfect and there are situations in which their use is not possible. 1.2 This blog examines various scenarios in which UDTs are used between COM and managed code (specifically C#). We will also analyze the success … Continue reading

Returning Strings from a C++ API to C#

1. Introduction. 1.1 APIs that return strings are very common. However, the internal nature of such APIs, as well as the use of such APIs in managed code, require special attention. This blog will demonstrate both concerns. 1.2 I will present several techniques for returning an unmanaged string to managed code. But before that I shall first provide an … Continue reading