Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
fml::NativeLibrary Class Reference

#include <native_library.h>

Inheritance diagram for fml::NativeLibrary:
fml::RefCountedThreadSafe< NativeLibrary > fml::internal::RefCountedThreadSafeBase

Public Types

using Handle = void *
 
using SymbolHandle = void *
 

Public Member Functions

template<typename T >
const std::optional< TResolveFunction (const char *symbol)
 
const uint8_t * ResolveSymbol (const char *symbol)
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< NativeLibrary >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 

Static Public Member Functions

static fml::RefPtr< NativeLibraryCreate (const char *path)
 
static fml::RefPtr< NativeLibraryCreateWithHandle (Handle handle, bool close_handle_when_done)
 
static fml::RefPtr< NativeLibraryCreateForCurrentProcess ()
 

Additional Inherited Members

- Protected Member Functions inherited from fml::RefCountedThreadSafe< NativeLibrary >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 

Detailed Description

Definition at line 20 of file native_library.h.

Member Typedef Documentation

◆ Handle

Definition at line 26 of file native_library.h.

◆ SymbolHandle

Definition at line 27 of file native_library.h.

Member Function Documentation

◆ Create()

fml::RefPtr< NativeLibrary > fml::NativeLibrary::Create ( const char *  path)
static

Definition at line 43 of file native_library_posix.cc.

43 {
44 auto library = fml::AdoptRef(new NativeLibrary(path));
45 return library->GetHandle() != nullptr ? library : nullptr;
46}
RefPtr< T > AdoptRef(T *ptr)
Definition ref_ptr.h:222

◆ CreateForCurrentProcess()

fml::RefPtr< NativeLibrary > fml::NativeLibrary::CreateForCurrentProcess ( )
static

Definition at line 56 of file native_library_posix.cc.

56 {
57 return fml::AdoptRef(new NativeLibrary(RTLD_DEFAULT, false));
58}

◆ CreateWithHandle()

fml::RefPtr< NativeLibrary > fml::NativeLibrary::CreateWithHandle ( Handle  handle,
bool  close_handle_when_done 
)
static

Definition at line 48 of file native_library_posix.cc.

50 {
51 auto library =
52 fml::AdoptRef(new NativeLibrary(handle, close_handle_when_done));
53 return library->GetHandle() != nullptr ? library : nullptr;
54}

◆ ResolveFunction()

template<typename T >
const std::optional< T > fml::NativeLibrary::ResolveFunction ( const char *  symbol)
inline

Definition at line 39 of file native_library.h.

39 {
40 auto* resolved_symbol = Resolve(symbol);
41 if (!resolved_symbol) {
42 return std::nullopt;
43 }
44 return std::optional<T>(reinterpret_cast<T>(resolved_symbol));
45 }
#define T

◆ ResolveSymbol()

const uint8_t * fml::NativeLibrary::ResolveSymbol ( const char *  symbol)
inline

Definition at line 47 of file native_library.h.

47 {
48 auto* resolved_symbol = reinterpret_cast<const uint8_t*>(Resolve(symbol));
49 if (resolved_symbol == nullptr) {
50 FML_DLOG(INFO) << "Could not resolve symbol in library: " << symbol;
51 }
52 return resolved_symbol;
53 }
#define FML_DLOG(severity)
Definition logging.h:102

The documentation for this class was generated from the following files: