LinkWithAttribute Class

Definition

A LinkWith attribute specifies how the native library associated with the assembly should be linked to the resulting application.

[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true)]
public sealed class LinkWithAttribute : Attribute
type LinkWithAttribute = class
    inherit Attribute
Inheritance
LinkWithAttribute
Attributes

Remarks

This attribute is only useful for assemblies that bind to native libraries.

When using this attribute, the specified library in the constructor will be linked with the final application. You can use one or more of the properties of the attribute to configure how the linking is done.

// The following is used to link with GoogleAdMobAds:

[assembly: LinkWith ("libGoogleAdMobAds.a", 
		     ForceLoad = true, 
		     Frameworks = "AudioToolbox MessageUI SystemConfiguration CoreGraphics MediaPlayer StoreKit", 
		     WeakFrameworks = "AdSupport", 
		     IsCxx = true, 
		     SmartLink = true,
		     LinkerFlags = "-lz -lsqlite3")]
[assembly: LinkerSafe]

Constructors

LinkWithAttribute()

Creates a new LinkWithAttribute to specify custom build/linker flags for the managed assembly.

LinkWithAttribute(String)

Creates a new LinkWithAttribute for the specified native library.

LinkWithAttribute(String, LinkTarget)

Creates a new LinkWithAttribute for the specified native library targetting the specified platform(s).

LinkWithAttribute(String, LinkTarget, String)

Creates a new LinkWithAttribute for the specified native library targetting the specified platform(s).

Properties

Dlsym

Specifies if the managed assembly requires using dlsym to resolve P/Invokes to native functions.

ForceLoad

Specifies whether or not the -force_load clang argument is required when linking this native library.

Frameworks

Specifies a space-delimited list of platform Frameworks required by the native library.

IsCxx

Specifies whether or not the native library is a C++ library.

LibraryName

The name of the native library.

LinkerFlags

Additional linker flags that are required for linking the native library to an application.

LinkTarget

The target platform (or platforms) that this library is built for.

NeedsGccExceptionHandling

Specifies whether or not the native library requires linking with the GCC Exception Handling library (libgcc_eh).

SmartLink

If this is set true, the ForceLoad value will be ignored when it is deemed safe to do so.

WeakFrameworks

Specifies a list of space-delimited platform Frameworks that should be weakly linked.

Applies to