Unmanaged Exports

From The Oxygene Language Wiki

Jump to:navigation, search

This is a Platform topic
Feel free to add your notes to this topic below.



Unmanaged exports export support was introduced in the May 2009 Release (3.0.19). This attribute is a special attribute defined in the RemObjects.Oxygene.System namespace and is called UnmanagedExportAttribute. It can be used on class methods only and it will export the method as a native (win32) export. When using this, the cpu type of an assembly has to be set to x86 or x64. AnyCPU cannot work, as native jumps require native code. The (virtual) attribute is defined as:

type
  [AttributeUsage(AttributeTargets.Method)]
  RemObjects.Oxygene.System.UnmanagedExportAttribute = public class(System.Attribute)
  public
    constructor;
    constructor(aExportName: string);
    constructor(aExportName: string; aCallingConv: CallingConvention);
  end;

When omitted, the aExportName will match the method now and the aCallingConv will be stdcall.

To use this, simply apply the attribute:

[UnmanagedExport('ShowMessage')]
class method ShowMessage(aMsg: string);


See Also


Oxygene-48.png

Area: Oxygene Platforms

Platform GlossaryKeywordsTypesFAQHow To

Navigation
Areas
More
Toolbox