5#include "flutter/fml/native_library.h"
9#include "flutter/fml/platform/win/wstring_conversion.h"
13NativeLibrary::NativeLibrary(
const char* path)
15 if (path ==
nullptr) {
22NativeLibrary::NativeLibrary(Handle handle,
bool close_handle)
23 :
handle_(handle), close_handle_(close_handle) {}
25NativeLibrary::~NativeLibrary() {
26 if (
handle_ !=
nullptr && close_handle_) {
31NativeLibrary::Handle NativeLibrary::GetHandle()
const {
37 return library->GetHandle() !=
nullptr ? library :
nullptr;
42 bool close_handle_when_done) {
44 fml::AdoptRef(
new NativeLibrary(handle, close_handle_when_done));
45 return library->GetHandle() !=
nullptr ? library :
nullptr;
49 return fml::AdoptRef(
new NativeLibrary(::GetModuleHandle(
nullptr),
false));
52NativeLibrary::SymbolHandle NativeLibrary::Resolve(
const char* symbol)
const {
53 if (symbol ==
nullptr ||
handle_ ==
nullptr) {
56 return ::GetProcAddress(
handle_, symbol);
std::wstring Utf8ToWideString(const std::string_view str)
RefPtr< T > AdoptRef(T *ptr)