// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Runtime.InteropServices; public delegate void CallBack(string s); public class Test { [DllImport("cb.dll", EntryPoint="set_callback")] public static extern void SetCallBack(CallBack cb); [DllImport("cb.dll", EntryPoint="dosomething")] public static extern void DoSomething(); public static void Main() { SetCallBack(TestCallBack); DoSomething(); } public static void TestCallBack(string s) { Console.Write(s); } }