Lim Bio Liong

I've been in software development for nearly 20 years specializing in C , COM and C#. It's truly an exicting time we live in, with so much resources at our disposal to gain and share knowledge. I hope my blog will serve a small part in this global knowledge sharing network. For many years now I've been deeply involved with C development work. However since circa 2010, my current work has required me to use more and more on C# with a particular focus on COM interop. I've also written several articles for CodeProject. However, in recent years I've concentrated my time more on helping others in the MSDN forums. Please feel free to leave a comment whenever you have any constructive criticism over any of my blog posts.
Lim Bio Liong has written 124 posts for limbioliong

Using the TypeLibConverter to Customize Type Library Creation from an Assembly Part 1.

1. Introduction. 1.1 Creation of COM type libraries from an assembly with COM-visible constructs (e.g. classes, interfaces, etc) is usually performed using REGASM.EXE or TLBEXP.EXE. 1.2 However, these tools provide standardized assembly to type library type transformations which cannot be customized. 1.3 To customize type library creation, the .NET framework provides the TypeLibConverter class. 1.4 … Continue reading

Programmatically Adding/Removing Paths to/from the System Path

1. Introduction. 1.1 Recently, my development team had to programmatically add a new path to the system path. 1.2 After doing some research, we successfully wrote a small program that performs this small feat. 1.3 In this post, I share the code that was used to accomplish this task. 2. Altering the System Path. 2.1 … Continue reading

Example Custom Marshaler – The Array Marshaler

1. Introduction. 1.1 A very useful .NET feature is the marshaling of managed arrays to unmanaged functions by using the MarshalAsAttribute with the MarshalAsAttribute.Value set to UnmanagedType.LPArray in conjunction with using the SizeParamIndex field. 1.2 The array may even be marshaled in both directions, i.e. to unmanaged code and then back to managed with data … Continue reading

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