UnmanagedExport

The UnmanagedExport aspect is a .NET-only attribute that can be used to export a .NET method as a .dll export that can then be accessed from unmanaged code, such as C or Island/Windows. The attribute can only be applied to static methods on non-generic classes and only in projects with an specific Architecture project (e.g. x86 or x86_64, but not "AnyCpu", the default for .NET). Additionally it requires the "Allow Unsafe code" project setting to be enabled, as well.

The aspect has two optional parameters:

  • Name: a string to override the name of the dll export, by default this matches the method name.
  • CallingConvention: a value of the CallingConvention enum that overrides the calling convention used for the exported method. The default here is the Pascal-style stdcall used by most native Windows APIs.
[UnmanagedExport('WriteLn')]
method WriteLine(aMessage: String);
begin
end;
[UnmanagedExport(("WriteLn")]
public void WriteLine(string message)
{
}
@UnmanagedExport(("WriteLn")
public func WriteLine(_ message: String!) {
}
@UnmanagedExport(("WriteLn")
public void WriteLine(string message)
{
}
<UnmanagedExport("WriteLn")>
Public Sub WriteLine(message As String)

End Sub

Defined by the RemObjects.Elements.Cirrus dll.

.NET

The UnmanagedExport aspect is available on the .NET platform only.

See Also