10#if defined(DART_HOST_OS_WINDOWS)
13#include <combaseapi.h>
17#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
18 defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_FUCHSIA)
28#define SET_ERROR_MSG(error_msg, format, ...) \
29 intptr_t len = snprintf(nullptr, 0, format, __VA_ARGS__); \
30 char* msg = reinterpret_cast<char*>(malloc(len + 1)); \
31 snprintf(msg, len + 1, format, __VA_ARGS__); \
34#if defined(DART_TARGET_OS_WINDOWS)
36static void ReplaceBackSlashes(
char* cstr) {
37 const intptr_t
length = strlen(cstr);
39 cstr[
i] = cstr[
i] ==
'\\' ?
'/' : cstr[
i];
68 const intptr_t
len = strlen(canon_path);
72#if defined(DART_TARGET_OS_WINDOWS)
82 char**
error =
nullptr) {
83 char* utils_error =
nullptr;
85 if (utils_error !=
nullptr) {
86 if (
error !=
nullptr) {
88 library_file !=
nullptr ? library_file :
"<process>",
96#if defined(DART_HOST_OS_WINDOWS)
98const nullptr_t kWindowsDynamicLibraryProcessPtr =
nullptr;
102 if (*
error !=
nullptr) {
103 char* inner_error = *
error;
111 const char* script_uri,
113 if (*
error !=
nullptr) {
114 char* inner_error = *
error;
116 "Failed to load dynamic library '%s' relative to '%s': %s",
117 path, script_uri, inner_error);
130 const char* script_uri,
132 void* handle =
nullptr;
134 const intptr_t
len = strlen(
path);
137#if defined(DART_TARGET_OS_WINDOWS)
143 platform_script_cstr.get());
161#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
162 defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_FUCHSIA)
165 return kWindowsDynamicLibraryProcessPtr;
173#if defined(DART_HOST_OS_WINDOWS)
174void* co_task_mem_allocated =
nullptr;
178void* LookupSymbolInProcess(
const char* symbol,
char**
error) {
180 if (co_task_mem_allocated ==
nullptr) {
181 co_task_mem_allocated = CoTaskMemAlloc(
sizeof(intptr_t));
182 CoTaskMemFree(co_task_mem_allocated);
186 OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
FALSE,
188 if (current_process ==
nullptr) {
197 for (intptr_t
i = 0;
i < (cb_needed /
sizeof(
HMODULE));
i++) {
199 reinterpret_cast<void*
>(GetProcAddress(
modules[
i], symbol))) {
200 CloseHandle(current_process);
205 CloseHandle(current_process);
208 error,
"None of the loaded modules contained the requested symbol '%s'.",
217#if defined(DART_HOST_OS_WINDOWS)
218 if (handle == kWindowsDynamicLibraryProcessPtr) {
219 return LookupSymbolInProcess(symbol,
error);
227 if (*
error !=
nullptr) {
228 char* inner_error = *
error;
static void * LoadDynamicLibrary(const char *library_path, char **error=nullptr)
static void * ResolveSymbolInDynamicLibrary(void *library_handle, const char *symbol, char **error=nullptr)
static const char * GetCanonicalPath(Namespace *namespc, const char *path, char *dest=nullptr, int dest_size=0)
static CStringUniquePtr UriToPath(const char *uri)
static void * DlopenSystem(const char *path, char **error)
static void * DlopenExecutable(char **error)
static void * DlopenProcess(char **error)
static void * DlopenRelative(const char *path, const char *script_uri, char **error)
static void * Dlsym(void *handle, const char *symbol, char **error)
static void * DlopenAbsolute(const char *path, char **error)
const uint8_t uint32_t uint32_t GError ** error
static void WrapError(const char *path, char **error)
static void * LoadDynamicLibrary(const char *library_file, char **error=nullptr)
const int file_schema_length
CStringUniquePtr CleanScriptUri(const char *script_uri)
static void * ResolveSymbol(void *handle, const char *symbol, char **error)
static void WrapErrorRelative(const char *path, const char *script_uri, char **error)
CAllocUniquePtr< char > CStringUniquePtr
void * malloc(size_t size)
CStringUniquePtr ResolveUri(const char *ref_uri, const char *base_uri)
static zx_koid_t GetCurrentProcessId()
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
char * strdup(const char *str1)
#define SET_ERROR_MSG(error_msg, format,...)
SKWASM_EXPORT SkPath * path_copy(SkPath *path)