Table of Contents

Class OpenMpApiAttribute

Namespace
SampSharp.OpenMp.Core
Assembly
SampSharp.OpenMp.Core.dll

This attributes marks a struct as an open.mp API interface. The struct must be marked as partial. All partial methods in the struct will be considered as open.mp API functions and will have P/Invoke implementations generated by the source generator. The invoked function name will be {interface}_{method_in_pascalCase}{overloadAppendix}. For example for the function IConfig.RemoveBan, the C function will be IConfig_removeBan. The overload appendix can be controlled using the OpenMpApiOverloadAttribute .

[AttributeUsage(AttributeTargets.Struct)]
public class OpenMpApiAttribute : Attribute
Inheritance
OpenMpApiAttribute
Inherited Members

Constructors

OpenMpApiAttribute(params Type[])

This attributes marks a struct as an open.mp API interface. The struct must be marked as partial. All partial methods in the struct will be considered as open.mp API functions and will have P/Invoke implementations generated by the source generator. The invoked function name will be {interface}_{method_in_pascalCase}{overloadAppendix}. For example for the function IConfig.RemoveBan, the C function will be IConfig_removeBan. The overload appendix can be controlled using the OpenMpApiOverloadAttribute .

public OpenMpApiAttribute(params Type[] baseTypeList)

Parameters

baseTypeList Type[]

Specifies which open.mp API interface struct types this struct implements. Equality members, cast operators and forwarding methods will be generated for all specified interfaces.

Properties

BaseTypeList

Gets which open.mp API interface struct types this struct implements. Equality members, cast operators and forwarding methods will be generated for all specified interfaces.

public Type[] BaseTypeList { get; }

Property Value

Type[]

Library

Gets or sets the name of the component library that contains the open.mp API functions. Defaults to "SampSharp".

public string Library { get; set; }

Property Value

string

NativeTypeName

Gets or sets the name of the open.mp API interface. Defaults to the struct name.

public string? NativeTypeName { get; set; }

Property Value

string