DllImport

The DllImport aspect imports native method from the given dynamic library. The aspect takes the name of the library (a .dll, .so, or .dylib, depending on platform) as a parameter. Optionally an EntryPoint can be provided to more precisely specify he native name of the method to be imported, if it does not match the local declaration.

The DllImport aspect can only be applied to static methods that have been marked as external (Oxygene) or extern (C#) or __external (Swift) or native (Java).

.NET and Island Only

The DllExport aspect is available only on the .NET and Island platforms.

type
  MyClass = public class 
  public  
    [DllImport("Foo.dll")]
    class method SomeNativeCode(); external;
  end;
public class MyClass
{
    [DllImport("Foo.dll")]
    public static extern void SomeNativeCode();
}
public class MyClass {
    @DllImport("Foo.dll")
    public extern func SomeNativeCode()
}
public class MyClass {
    @DllImport("Foo.dll")
    public static extern void SomeNativeCode();
}

See Also