Edytuj

Udostępnij za pośrednictwem


DlsymOption Enum

Definition

Used to specify if a library requires using dlsym to resolve P/Invokes to native functions.

public enum DlsymOption
type DlsymOption = 
Inheritance
DlsymOption

Fields

Name Value Description
Default 0

Use the default value for the platform (for backwards compatibility reasons the default is to use dlsym on platforms that support it - this may change in the future).

Required 1

This library requires using dlsym to resolve P/Invokes to native functions.

Disabled 2

This library does not depend on using dlsym to resolve P/Invokes to native functions.

Remarks

This enum is used to specify whether a library requires using dlsym to resolve P/Invokes to native functions or not.

A library can require using dlsym if there are P/Invokes in the assembly that reference native functions that don't exist on the target platform.

If a library only contains P/Invokes to native functions that exist on the target platform, an AOT compiler can insert a direct call to the native function in the generated native code. This is faster than using dlsym at runtime to find the native function (and the code is also slightly smaller), but if the native function does not exist on the target platform, the app will not compile (the native linker will fail because it can't find the native function).

Applies to