DllImport: load dll library : DllImport « Windows « C# / CSharp Tutorial






using System;
using System.Runtime.InteropServices;

public sealed class MainClass
{
    [DllImport("kernel32.dll")]
    static extern IntPtr HeapCreate(uint flOptions, UIntPtr dwInitialSize,UIntPtr dwMaximumSize);

    [DllImport("kernel32.dll")]
    static extern bool HeapDestroy(IntPtr hHeap);

    public static void Main() {
        IntPtr theHeap = HeapCreate( 0, (UIntPtr) 4096, UIntPtr.Zero );
        HeapDestroy( theHeap );
        theHeap = IntPtr.Zero;
    }
}








29.12.DllImport
29.12.1.DllImport: load dll library
29.12.2.DllImport
29.12.3.External Method
29.12.4.Get address of a method from Dll
29.12.5.API File reader