//
archives

Archive for

Example Custom Marshaler – The File Handle Marshaler

1. Introduction. 1.1 This is the second “example code” article I am writing to demonstrate custom marshaling. 1.2 In the first example code extension to my “Understanding Custom Marshaling” series of articles, I wrote a custom marshaler that can be used to transform a C# long type (a 64-bit number) to an unmanaged LARGE_INTEGER structure. … Continue reading

Example Custom Marshaler – The Long Marshaler

1. Introduction. 1.1 I wish there is a survey on how many developers actually develop custom marshalers. 1.2 It would be interesting to know the type of custom marshalers that people develop. 1.3 In the course of my work, I have developed a few custom marshalers most of which deal with arrays that have to … Continue reading

Custom Marshaling – Comments and an Example Use of the Marshal Cookie

1. Introduction. 1.1 This article and several to follow are extensions to the “Understanding Custom Marshaling” series of articles designed to help readers understand the rudiments of custom marshaling in .NET. 1.2 In this article, I discuss some general observations about the custom marshaling mechanism that I hope the reader had the opportunity to make … Continue reading

Understanding Custom Marshaling Part 4

1. Introduction. 1.1 We have reached the 4th part of this series of articles elucidating the basic principles of custom marshaling. 1.2 In the first part, we touched on marshaling one-way from managed to unmanaged code. 1.3 Then in part 2 and 3, we studied marshaling the other way from unmanaged to managed. 1.4 Here … Continue reading

Understanding Custom Marshaling Part 3

1. Introduction. 1.1 This is the 3rd installment of our series of articles expounding .NET custom marshaling. 1.2 In part 2, we studied how custom marshaling may be performed from unmanaged code to managed. The idea being that the unmanaged code must return an object to managed code. 1.3 We also noted in part 2 … Continue reading

Understanding Custom Marshaling Part 2

1. Introduction. 1.1 This article is a continuation of Understanding Custom Marshaling Part 1. 1.2 In part 1, we learned how to code custom marshaling for the purpose of passing an object (a managed string) from managed code to unmanaged. 1.3 Here in part 2, we study how custom marshaling is done in the other … Continue reading

Understanding Custom Marshaling Part 1

1. Introduction. 1.1 Custom marshaling is a fascinating .NET feature. 1.2 As is the case for standard interop marshaling, it is used to transform data of a managed type into equivalent data of an unmanaged type for the purpose of parameter passing to/from an unmanaged function. 1.3 This article will demonstrate how custom marshaling can … Continue reading