Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
dart_api_dl.c File Reference
#include "dart_api_dl.h"
#include "dart_version.h"
#include "internal/dart_api_dl_impl.h"
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Macros

#define DART_API_DL_DEFINITIONS(name, R, A)   name##_Type name##_DL = NULL;
 
#define DART_API_DL_INIT(name, R, A)
 
#define DART_API_DEPRECATED_DL_INIT(name, R, A)    name##_DL = name##_Deprecated;
 

Typedefs

typedef void * DartApiEntry_function
 

Functions

DartApiEntry_function FindFunctionPointer (const DartApiEntry *entries, const char *name)
 
DART_EXPORT void Dart_UpdateExternalSize_Deprecated (Dart_WeakPersistentHandle object, intptr_t external_size)
 
DART_EXPORT void Dart_UpdateFinalizableExternalSize_Deprecated (Dart_FinalizableHandle object, Dart_Handle strong_ref_to_object, intptr_t external_allocation_size)
 
intptr_t Dart_InitializeApiDL (void *data)
 

Macro Definition Documentation

◆ DART_API_DEPRECATED_DL_INIT

#define DART_API_DEPRECATED_DL_INIT (   name,
  R,
  A 
)     name##_DL = name##_Deprecated;

◆ DART_API_DL_DEFINITIONS

#define DART_API_DL_DEFINITIONS (   name,
  R,
  A 
)    name##_Type name##_DL = NULL;

Definition at line 14 of file dart_api_dl.c.

◆ DART_API_DL_INIT

#define DART_API_DL_INIT (   name,
  R,
  A 
)
Value:
name##_DL = \
(name##_Type)(FindFunctionPointer(dart_api_function_pointers, #name));
DartApiEntry_function FindFunctionPointer(const DartApiEntry *entries, const char *name)
Definition dart_api_dl.c:23
const char * name
Definition fuchsia.cc:50

Typedef Documentation

◆ DartApiEntry_function

typedef void* DartApiEntry_function

Definition at line 21 of file dart_api_dl.c.

Function Documentation

◆ Dart_InitializeApiDL()

intptr_t Dart_InitializeApiDL ( void *  data)

Definition at line 45 of file dart_api_dl.c.

45 {
46 DartApi* dart_api_data = (DartApi*)data;
47
48 if (dart_api_data->major != DART_API_DL_MAJOR_VERSION) {
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}
#define DART_API_DL_INIT(name, R, A)
#define DART_API_DEPRECATED_DL_INIT(name, R, A)
#define DART_API_ALL_DL_SYMBOLS(F)
#define DART_API_DEPRECATED_DL_SYMBOLS(F)
#define DART_API_DL_MAJOR_VERSION
const int major
const DartApiEntry *const functions

◆ Dart_UpdateExternalSize_Deprecated()

DART_EXPORT void Dart_UpdateExternalSize_Deprecated ( Dart_WeakPersistentHandle  object,
intptr_t  external_size 
)

Definition at line 32 of file dart_api_dl.c.

33 {
34 printf("Dart_UpdateExternalSize is a nop, it has been deprecated\n");
35}
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1

◆ Dart_UpdateFinalizableExternalSize_Deprecated()

DART_EXPORT void Dart_UpdateFinalizableExternalSize_Deprecated ( Dart_FinalizableHandle  object,
Dart_Handle  strong_ref_to_object,
intptr_t  external_allocation_size 
)

Definition at line 37 of file dart_api_dl.c.

40 {
41 printf("Dart_UpdateFinalizableExternalSize is a nop, "
42 "it has been deprecated\n");
43}

◆ FindFunctionPointer()

DartApiEntry_function FindFunctionPointer ( const DartApiEntry entries,
const char *  name 
)

Definition at line 23 of file dart_api_dl.c.

24 {
25 while (entries->name != NULL) {
26 if (strcmp(entries->name, name) == 0) return entries->function;
27 entries++;
28 }
29 return NULL;
30}
const char * name
void(* function)(void)