//
archives

Delegates

This category contains 3 posts

Handling .NET Events in Unmanaged Code using Event Accessors.

1. Introduction. 1.1 In the .NET framework, events are activated and handled using the event-delegate model. 1.2 Such a system is alien to unmanaged code. 1.3 However, there are ways to bridge .NET events to the unmanaged world. COM interop (via the use of the ComSourceInterfacesAttribute) being the conventional way. 1.4 The specific technique used is the COM connection … Continue reading

Delegates As Callbacks Part 2

1. Introduction. 1.1 This blog is a continuation of an earlier blog Delegates As Callbacks Part 1. 1.2 In this part 2, I shall demonstrate using managed methods as callbacks that can be invoked from unmanaged code. 2. Sample Code. 2.1 Listed below is a sample unmanaged code written in C++ : typedef void (__stdcall … Continue reading

Delegates as Callbacks Part 1

1. Introduction 1.1 A concept frequently used in real-world software development is that of a callback. 1.2 A callback, as we know, is a function which is asynchronously called, often when some event of significance occurs. 1.3 This series of blogs examines how this concept is realized between managed and unmanaged code. In this part … Continue reading