Flutter Engine
The Flutter Engine
dart_api_dl.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
3 * for details. All rights reserved. Use of this source code is governed by a
4 * BSD-style license that can be found in the LICENSE file.
5 */
6
7#include "dart_api_dl.h" /* NOLINT */
8#include "dart_version.h" /* NOLINT */
9#include "internal/dart_api_dl_impl.h" /* NOLINT */
10
11#include <stdio.h>
12#include <string.h>
13
14#define DART_API_DL_DEFINITIONS(name, R, A) name##_Type name##_DL = NULL;
15
18
19#undef DART_API_DL_DEFINITIONS
20
22
24 const char* name) {
25 while (entries->name != NULL) {
26 if (strcmp(entries->name, name) == 0) return entries->function;
27 entries++;
28 }
29 return NULL;
30}
31
33 Dart_WeakPersistentHandle object, intptr_t external_size) {
34 printf("Dart_UpdateExternalSize is a nop, it has been deprecated\n");
35}
36
39 Dart_Handle strong_ref_to_object,
40 intptr_t external_allocation_size) {
41 printf("Dart_UpdateFinalizableExternalSize is a nop, "
42 "it has been deprecated\n");
43}
44
45intptr_t Dart_InitializeApiDL(void* data) {
47
49 // If the DartVM we're running on does not have the same version as this
50 // file was compiled against, refuse to initialize. The symbols are not
51 // compatible.
52 return -1;
53 }
54 // Minor versions are allowed to be different.
55 // If the DartVM has a higher minor version, it will provide more symbols
56 // than we initialize here.
57 // If the DartVM has a lower minor version, it will not provide all symbols.
58 // In that case, we leave the missing symbols un-initialized. Those symbols
59 // should not be used by the Dart and native code. The client is responsible
60 // for checking the minor version number himself based on which symbols it
61 // is using.
62 // (If we would error out on this case, recompiling native code against a
63 // newer SDK would break all uses on older SDKs, which is too strict.)
64
65 const DartApiEntry* dart_api_function_pointers = dart_api_data->functions;
66
67#define DART_API_DL_INIT(name, R, A) \
68 name##_DL = \
69 (name##_Type)(FindFunctionPointer(dart_api_function_pointers, #name));
71#undef DART_API_DL_INIT
72
73#define DART_API_DEPRECATED_DL_INIT(name, R, A) \
74 name##_DL = name##_Deprecated;
76#undef DART_API_DEPRECATED_DL_INIT
77
78 return 0;
79}
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
struct _Dart_FinalizableHandle * Dart_FinalizableHandle
Definition: dart_api.h:261
struct _Dart_WeakPersistentHandle * Dart_WeakPersistentHandle
Definition: dart_api.h:260
DART_EXPORT void Dart_UpdateExternalSize_Deprecated(Dart_WeakPersistentHandle object, intptr_t external_size)
Definition: dart_api_dl.c:32
intptr_t Dart_InitializeApiDL(void *data)
Definition: dart_api_dl.c:45
DartApiEntry_function FindFunctionPointer(const DartApiEntry *entries, const char *name)
Definition: dart_api_dl.c:23
void * DartApiEntry_function
Definition: dart_api_dl.c:21
#define DART_API_DL_INIT(name, R, A)
DART_EXPORT void Dart_UpdateFinalizableExternalSize_Deprecated(Dart_FinalizableHandle object, Dart_Handle strong_ref_to_object, intptr_t external_allocation_size)
Definition: dart_api_dl.c:37
#define DART_API_DL_DEFINITIONS(name, R, A)
Definition: dart_api_dl.c:14
#define DART_API_DEPRECATED_DL_INIT(name, R, A)
#define DART_API_ALL_DL_SYMBOLS(F)
Definition: dart_api_dl.h:123
#define DART_API_DEPRECATED_DL_SYMBOLS(F)
Definition: dart_api_dl.h:116
#define DART_API_DL_MAJOR_VERSION
Definition: dart_version.h:13
#define DART_EXPORT
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: SkSLString.cpp:83
static const DartApi dart_api_data
Definition: ffi.cc:93
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
const char * name
void(* function)(void)
const int major
const DartApiEntry *const functions
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63