dart_sys_fork/lib.rs
1//! Opt-in style bindings to the Dart SDK
2//!
3//! This crate provides bindings to the Dart SDK. It is generated using
4//! [bindgen](https://crates.io/crates/bindgen) and the official Dart SDK.
5//!
6//! Bindings are generated statically, meaning that the Dart SDK headers are
7//! included in the crate and no external dependencies are required.
8#![no_std]
9#![allow(
10 non_upper_case_globals,
11 non_camel_case_types,
12 non_snake_case,
13 unused_variables,
14 dead_code
15)]
16// automatically generated by rust-bindgen 0.69.1
17
18pub type va_list = *mut ::core::ffi::c_char;
19pub type __vcrt_bool = bool;
20pub type wchar_t = ::core::ffi::c_ushort;
21pub type __crt_bool = bool;
22pub type errno_t = ::core::ffi::c_int;
23pub type wint_t = ::core::ffi::c_ushort;
24pub type wctype_t = ::core::ffi::c_ushort;
25pub type __time32_t = ::core::ffi::c_long;
26pub type __time64_t = ::core::ffi::c_longlong;
27pub type _locale_t = *mut __crt_locale_pointers;
28pub type mbstate_t = _Mbstatet;
29pub type time_t = __time64_t;
30pub type rsize_t = usize;
31pub type int_least8_t = ::core::ffi::c_schar;
32pub type int_least16_t = ::core::ffi::c_short;
33pub type int_least32_t = ::core::ffi::c_int;
34pub type int_least64_t = ::core::ffi::c_longlong;
35pub type uint_least8_t = ::core::ffi::c_uchar;
36pub type uint_least16_t = ::core::ffi::c_ushort;
37pub type uint_least32_t = ::core::ffi::c_uint;
38pub type uint_least64_t = ::core::ffi::c_ulonglong;
39pub type int_fast8_t = ::core::ffi::c_schar;
40pub type int_fast16_t = ::core::ffi::c_int;
41pub type int_fast32_t = ::core::ffi::c_int;
42pub type int_fast64_t = ::core::ffi::c_longlong;
43pub type uint_fast8_t = ::core::ffi::c_uchar;
44pub type uint_fast16_t = ::core::ffi::c_uint;
45pub type uint_fast32_t = ::core::ffi::c_uint;
46pub type uint_fast64_t = ::core::ffi::c_ulonglong;
47pub type intmax_t = ::core::ffi::c_longlong;
48pub type uintmax_t = ::core::ffi::c_ulonglong;
49pub type imaxdiv_t = _Lldiv_t;
50/// An isolate is the unit of concurrency in Dart. Each isolate has
51/// its own memory and thread of control. No state is shared between
52/// isolates. Instead, isolates communicate by message passing.
53///
54/// Each thread keeps track of its current isolate, which is the
55/// isolate which is ready to execute on the current thread. The
56/// current isolate may be NULL, in which case no isolate is ready to
57/// execute. Most of the Dart apis require there to be a current
58/// isolate in order to function without error. The current isolate is
59/// set by any call to Dart_CreateIsolateGroup or Dart_EnterIsolate.
60pub type Dart_Isolate = *mut _Dart_Isolate;
61pub type Dart_IsolateGroup = *mut _Dart_IsolateGroup;
62/// An object reference managed by the Dart VM garbage collector.
63///
64/// Because the garbage collector may move objects, it is unsafe to
65/// refer to objects directly. Instead, we refer to objects through
66/// handles, which are known to the garbage collector and updated
67/// automatically when the object is moved. Handles should be passed
68/// by value (except in cases like out-parameters) and should never be
69/// allocated on the heap.
70///
71/// Most functions in the Dart Embedding API return a handle. When a
72/// function completes normally, this will be a valid handle to an
73/// object in the Dart VM heap. This handle may represent the result of
74/// the operation or it may be a special valid handle used merely to
75/// indicate successful completion. Note that a valid handle may in
76/// some cases refer to the null object.
77///
78/// --- Error handles ---
79///
80/// When a function encounters a problem that prevents it from
81/// completing normally, it returns an error handle (See Dart_IsError).
82/// An error handle has an associated error message that gives more
83/// details about the problem (See Dart_GetError).
84///
85/// There are four kinds of error handles that can be produced,
86/// depending on what goes wrong:
87///
88/// - Api error handles are produced when an api function is misused. This happens when a Dart
89/// embedding api function is called with invalid arguments or in an invalid context.
90///
91/// - Unhandled exception error handles are produced when, during the execution of Dart code, an
92/// exception is thrown but not caught. Prototypically this would occur during a call to
93/// Dart_Invoke, but it can occur in any function which triggers the execution of Dart code (for
94/// example, Dart_ToString).
95///
96/// An unhandled exception error provides access to an exception and
97/// stacktrace via the functions Dart_ErrorGetException and
98/// Dart_ErrorGetStackTrace.
99///
100/// - Compilation error handles are produced when, during the execution of Dart code, a compile-time
101/// error occurs. As above, this can occur in any function which triggers the execution of Dart
102/// code.
103///
104/// - Fatal error handles are produced when the system wants to shut down the current isolate.
105///
106/// --- Propagating errors ---
107///
108/// When an error handle is returned from the top level invocation of
109/// Dart code in a program, the embedder must handle the error as they
110/// see fit. Often, the embedder will print the error message produced
111/// by Dart_Error and exit the program.
112///
113/// When an error is returned while in the body of a native function,
114/// it can be propagated up the call stack by calling
115/// Dart_PropagateError, Dart_SetReturnValue, or Dart_ThrowException.
116/// Errors should be propagated unless there is a specific reason not
117/// to. If an error is not propagated then it is ignored. For
118/// example, if an unhandled exception error is ignored, that
119/// effectively "catches" the unhandled exception. Fatal errors must
120/// always be propagated.
121///
122/// When an error is propagated, any current scopes created by
123/// Dart_EnterScope will be exited.
124///
125/// Using Dart_SetReturnValue to propagate an exception is somewhat
126/// more convenient than using Dart_PropagateError, and should be
127/// preferred for reasons discussed below.
128///
129/// Dart_PropagateError and Dart_ThrowException do not return. Instead
130/// they transfer control non-locally using a setjmp-like mechanism.
131/// This can be inconvenient if you have resources that you need to
132/// clean up before propagating the error.
133///
134/// When relying on Dart_PropagateError, we often return error handles
135/// rather than propagating them from helper functions. Consider the
136/// following contrived example:
137///
138/// 1 Dart_Handle isLongStringHelper(Dart_Handle arg) {
139/// 2 intptr_t* length = 0;
140/// 3 result = Dart_StringLength(arg, &length);
141/// 4 if (Dart_IsError(result)) {
142/// 5 return result;
143/// 6 }
144/// 7 return Dart_NewBoolean(length > 100);
145/// 8 }
146/// 9
147/// 10 void NativeFunction_isLongString(Dart_NativeArguments args) {
148/// 11 Dart_EnterScope();
149/// 12 AllocateMyResource();
150/// 13 Dart_Handle arg = Dart_GetNativeArgument(args, 0);
151/// 14 Dart_Handle result = isLongStringHelper(arg);
152/// 15 if (Dart_IsError(result)) {
153/// 16 FreeMyResource();
154/// 17 Dart_PropagateError(result);
155/// 18 abort(); // will not reach here
156/// 19 }
157/// 20 Dart_SetReturnValue(result);
158/// 21 FreeMyResource();
159/// 22 Dart_ExitScope();
160/// 23 }
161///
162/// In this example, we have a native function which calls a helper
163/// function to do its work. On line 5, the helper function could call
164/// Dart_PropagateError, but that would not give the native function a
165/// chance to call FreeMyResource(), causing a leak. Instead, the
166/// helper function returns the error handle to the caller, giving the
167/// caller a chance to clean up before propagating the error handle.
168///
169/// When an error is propagated by calling Dart_SetReturnValue, the
170/// native function will be allowed to complete normally and then the
171/// exception will be propagated only once the native call
172/// returns. This can be convenient, as it allows the C code to clean
173/// up normally.
174///
175/// The example can be written more simply using Dart_SetReturnValue to
176/// propagate the error.
177///
178/// 1 Dart_Handle isLongStringHelper(Dart_Handle arg) {
179/// 2 intptr_t* length = 0;
180/// 3 result = Dart_StringLength(arg, &length);
181/// 4 if (Dart_IsError(result)) {
182/// 5 return result
183/// 6 }
184/// 7 return Dart_NewBoolean(length > 100);
185/// 8 }
186/// 9
187/// 10 void NativeFunction_isLongString(Dart_NativeArguments args) {
188/// 11 Dart_EnterScope();
189/// 12 AllocateMyResource();
190/// 13 Dart_Handle arg = Dart_GetNativeArgument(args, 0);
191/// 14 Dart_SetReturnValue(isLongStringHelper(arg));
192/// 15 FreeMyResource();
193/// 16 Dart_ExitScope();
194/// 17 }
195///
196/// In this example, the call to Dart_SetReturnValue on line 14 will
197/// either return the normal return value or the error (potentially
198/// generated on line 3). The call to FreeMyResource on line 15 will
199/// execute in either case.
200///
201/// --- Local and persistent handles ---
202///
203/// Local handles are allocated within the current scope (see
204/// Dart_EnterScope) and go away when the current scope exits. Unless
205/// otherwise indicated, callers should assume that all functions in
206/// the Dart embedding api return local handles.
207///
208/// Persistent handles are allocated within the current isolate. They
209/// can be used to store objects across scopes. Persistent handles have
210/// the lifetime of the current isolate unless they are explicitly
211/// deallocated (see Dart_DeletePersistentHandle).
212/// The type Dart_Handle represents a handle (both local and persistent).
213/// The type Dart_PersistentHandle is a Dart_Handle and it is used to
214/// document that a persistent handle is expected as a parameter to a call
215/// or the return value from a call is a persistent handle.
216///
217/// FinalizableHandles are persistent handles which are auto deleted when
218/// the object is garbage collected. It is never safe to use these handles
219/// unless you know the object is still reachable.
220///
221/// WeakPersistentHandles are persistent handles which are automatically set
222/// to point Dart_Null when the object is garbage collected. They are not auto
223/// deleted, so it is safe to use them after the object has become unreachable.
224pub type Dart_Handle = *mut _Dart_Handle;
225pub type Dart_PersistentHandle = Dart_Handle;
226pub type Dart_WeakPersistentHandle = *mut _Dart_WeakPersistentHandle;
227pub type Dart_FinalizableHandle = *mut _Dart_FinalizableHandle;
228pub type Dart_HandleFinalizer = ::core::option::Option<
229 unsafe extern "C" fn(isolate_callback_data: *mut ::core::ffi::c_void, peer: *mut ::core::ffi::c_void),
230>;
231/// An isolate creation and initialization callback function.
232///
233/// This callback, provided by the embedder, is called when the VM
234/// needs to create an isolate. The callback should create an isolate
235/// by calling Dart_CreateIsolateGroup and load any scripts required for
236/// execution.
237///
238/// This callback may be called on a different thread than the one
239/// running the parent isolate.
240///
241/// When the function returns NULL, it is the responsibility of this
242/// function to ensure that Dart_ShutdownIsolate has been called if
243/// required (for example, if the isolate was created successfully by
244/// Dart_CreateIsolateGroup() but the root library fails to load
245/// successfully, then the function should call Dart_ShutdownIsolate
246/// before returning).
247///
248/// When the function returns NULL, the function should set *error to
249/// a malloc-allocated buffer containing a useful error message. The
250/// caller of this function (the VM) will make sure that the buffer is
251/// freed.
252///
253/// \param script_uri The uri of the main source file or snapshot to load.
254/// Either the URI of the parent isolate set in Dart_CreateIsolateGroup for
255/// Isolate.spawn, or the argument to Isolate.spawnUri canonicalized by the
256/// library tag handler of the parent isolate.
257/// The callback is responsible for loading the program by a call to
258/// Dart_LoadScriptFromKernel.
259/// \param main The name of the main entry point this isolate will
260/// eventually run. This is provided for advisory purposes only to
261/// improve debugging messages. The main function is not invoked by
262/// this function.
263/// \param package_root Ignored.
264/// \param package_config Uri of the package configuration file (either in format
265/// of .packages or .dart_tool/package_config.json) for this isolate
266/// to resolve package imports against. If this parameter is not passed the
267/// package resolution of the parent isolate should be used.
268/// \param flags Default flags for this isolate being spawned. Either inherited
269/// from the spawning isolate or passed as parameters when spawning the
270/// isolate from Dart code.
271/// \param isolate_data The isolate data which was passed to the
272/// parent isolate when it was created by calling Dart_CreateIsolateGroup().
273/// \param error A structure into which the embedder can place a
274/// C string containing an error message in the case of failures.
275///
276/// \return The embedder returns NULL if the creation and
277/// initialization was not successful and the isolate if successful.
278pub type Dart_IsolateGroupCreateCallback = ::core::option::Option<
279 unsafe extern "C" fn(
280 script_uri: *const ::core::ffi::c_char,
281 main: *const ::core::ffi::c_char,
282 package_root: *const ::core::ffi::c_char,
283 package_config: *const ::core::ffi::c_char,
284 flags: *mut Dart_IsolateFlags,
285 isolate_data: *mut ::core::ffi::c_void,
286 error: *mut *mut ::core::ffi::c_char,
287 ) -> Dart_Isolate,
288>;
289/// An isolate initialization callback function.
290///
291/// This callback, provided by the embedder, is called when the VM has created an
292/// isolate within an existing isolate group (i.e. from the same source as an
293/// existing isolate).
294///
295/// The callback should setup native resolvers and might want to set a custom
296/// message handler via [Dart_SetMessageNotifyCallback] and mark the isolate as
297/// runnable.
298///
299/// This callback may be called on a different thread than the one
300/// running the parent isolate.
301///
302/// When the function returns `false`, it is the responsibility of this
303/// function to ensure that `Dart_ShutdownIsolate` has been called.
304///
305/// When the function returns `false`, the function should set *error to
306/// a malloc-allocated buffer containing a useful error message. The
307/// caller of this function (the VM) will make sure that the buffer is
308/// freed.
309///
310/// \param child_isolate_data The callback data to associate with the new
311/// child isolate.
312/// \param error A structure into which the embedder can place a
313/// C string containing an error message in the case the initialization fails.
314///
315/// \return The embedder returns true if the initialization was successful and
316/// false otherwise (in which case the VM will terminate the isolate).
317pub type Dart_InitializeIsolateCallback = ::core::option::Option<
318 unsafe extern "C" fn(
319 child_isolate_data: *mut *mut ::core::ffi::c_void,
320 error: *mut *mut ::core::ffi::c_char,
321 ) -> bool,
322>;
323/// An isolate shutdown callback function.
324///
325/// This callback, provided by the embedder, is called before the vm
326/// shuts down an isolate. The isolate being shutdown will be the current
327/// isolate. It is safe to run Dart code.
328///
329/// This function should be used to dispose of native resources that
330/// are allocated to an isolate in order to avoid leaks.
331///
332/// \param isolate_group_data The same callback data which was passed to the
333/// isolate group when it was created.
334/// \param isolate_data The same callback data which was passed to the isolate
335/// when it was created.
336pub type Dart_IsolateShutdownCallback = ::core::option::Option<
337 unsafe extern "C" fn(isolate_group_data: *mut ::core::ffi::c_void, isolate_data: *mut ::core::ffi::c_void),
338>;
339/// An isolate cleanup callback function.
340///
341/// This callback, provided by the embedder, is called after the vm
342/// shuts down an isolate. There will be no current isolate and it is *not*
343/// safe to run Dart code.
344///
345/// This function should be used to dispose of native resources that
346/// are allocated to an isolate in order to avoid leaks.
347///
348/// \param isolate_group_data The same callback data which was passed to the
349/// isolate group when it was created.
350/// \param isolate_data The same callback data which was passed to the isolate
351/// when it was created.
352pub type Dart_IsolateCleanupCallback = ::core::option::Option<
353 unsafe extern "C" fn(isolate_group_data: *mut ::core::ffi::c_void, isolate_data: *mut ::core::ffi::c_void),
354>;
355/// An isolate group cleanup callback function.
356///
357/// This callback, provided by the embedder, is called after the vm
358/// shuts down an isolate group.
359///
360/// This function should be used to dispose of native resources that
361/// are allocated to an isolate in order to avoid leaks.
362///
363/// \param isolate_group_data The same callback data which was passed to the
364/// isolate group when it was created.
365pub type Dart_IsolateGroupCleanupCallback =
366 ::core::option::Option<unsafe extern "C" fn(isolate_group_data: *mut ::core::ffi::c_void)>;
367/// A thread start callback function.
368/// This callback, provided by the embedder, is called after a thread in the
369/// vm thread pool starts.
370/// This function could be used to adjust thread priority or attach native
371/// resources to the thread.
372pub type Dart_ThreadStartCallback = ::core::option::Option<unsafe extern "C" fn()>;
373/// A thread death callback function.
374/// This callback, provided by the embedder, is called before a thread in the
375/// vm thread pool exits.
376/// This function could be used to dispose of native resources that
377/// are associated and attached to the thread, in order to avoid leaks.
378pub type Dart_ThreadExitCallback = ::core::option::Option<unsafe extern "C" fn()>;
379/// Opens a file for reading or writing.
380///
381/// Callback provided by the embedder for file operations. If the
382/// embedder does not allow file operations this callback can be
383/// NULL.
384///
385/// \param name The name of the file to open.
386/// \param write A boolean variable which indicates if the file is to
387/// opened for writing. If there is an existing file it needs to truncated.
388pub type Dart_FileOpenCallback = ::core::option::Option<
389 unsafe extern "C" fn(name: *const ::core::ffi::c_char, write: bool) -> *mut ::core::ffi::c_void,
390>;
391/// Read contents of file.
392///
393/// Callback provided by the embedder for file operations. If the
394/// embedder does not allow file operations this callback can be
395/// NULL.
396///
397/// \param data Buffer allocated in the callback into which the contents
398/// of the file are read into. It is the responsibility of the caller to
399/// free this buffer.
400/// \param file_length A variable into which the length of the file is returned.
401/// In the case of an error this value would be -1.
402/// \param stream Handle to the opened file.
403pub type Dart_FileReadCallback = ::core::option::Option<
404 unsafe extern "C" fn(data: *mut *mut u8, file_length: *mut isize, stream: *mut ::core::ffi::c_void),
405>;
406/// Write data into file.
407///
408/// Callback provided by the embedder for file operations. If the
409/// embedder does not allow file operations this callback can be
410/// NULL.
411///
412/// \param data Buffer which needs to be written into the file.
413/// \param length Length of the buffer.
414/// \param stream Handle to the opened file.
415pub type Dart_FileWriteCallback = ::core::option::Option<
416 unsafe extern "C" fn(data: *const ::core::ffi::c_void, length: isize, stream: *mut ::core::ffi::c_void),
417>;
418/// Closes the opened file.
419///
420/// Callback provided by the embedder for file operations. If the
421/// embedder does not allow file operations this callback can be
422/// NULL.
423///
424/// \param stream Handle to the opened file.
425pub type Dart_FileCloseCallback = ::core::option::Option<unsafe extern "C" fn(stream: *mut ::core::ffi::c_void)>;
426pub type Dart_EntropySource = ::core::option::Option<unsafe extern "C" fn(buffer: *mut u8, length: isize) -> bool>;
427/// Callback provided by the embedder that is used by the vmservice isolate
428/// to request the asset archive. The asset archive must be an uncompressed tar
429/// archive that is stored in a Uint8List.
430///
431/// If the embedder has no vmservice isolate assets, the callback can be NULL.
432///
433/// \return The embedder must return a handle to a Uint8List containing an
434/// uncompressed tar archive or null.
435pub type Dart_GetVMServiceAssetsArchive = ::core::option::Option<unsafe extern "C" fn() -> Dart_Handle>;
436/// Callback provided by the embedder that is used by the VM to notify on code
437/// object creation, *before* it is invoked the first time.
438/// This is useful for embedders wanting to e.g. keep track of PCs beyond
439/// the lifetime of the garbage collected code objects.
440/// Note that an address range may be used by more than one code object over the
441/// lifecycle of a process. Clients of this function should record timestamps for
442/// these compilation events and when collecting PCs to disambiguate reused
443/// address ranges.
444pub type Dart_OnNewCodeCallback = ::core::option::Option<
445 unsafe extern "C" fn(observer: *mut Dart_CodeObserver, name: *const ::core::ffi::c_char, base: usize, size: usize),
446>;
447/// Optional callback provided by the embedder that is used by the VM to
448/// implement registration of kernel blobs for the subsequent Isolate.spawnUri
449/// If no callback is provided, the registration of kernel blobs will throw
450/// an error.
451///
452/// \param kernel_buffer A buffer which contains a kernel program. Callback
453/// should copy the contents of `kernel_buffer` as
454/// it may be freed immediately after registration.
455/// \param kernel_buffer_size The size of `kernel_buffer`.
456///
457/// \return A C string representing URI which can be later used
458/// to spawn a new isolate. This C String should be scope allocated
459/// or owned by the embedder.
460/// Returns NULL if embedder runs out of memory.
461pub type Dart_RegisterKernelBlobCallback = ::core::option::Option<
462 unsafe extern "C" fn(kernel_buffer: *const u8, kernel_buffer_size: isize) -> *const ::core::ffi::c_char,
463>;
464/// Optional callback provided by the embedder that is used by the VM to
465/// unregister kernel blobs.
466/// If no callback is provided, the unregistration of kernel blobs will throw
467/// an error.
468///
469/// \param kernel_blob_uri URI of the kernel blob to unregister.
470pub type Dart_UnregisterKernelBlobCallback =
471 ::core::option::Option<unsafe extern "C" fn(kernel_blob_uri: *const ::core::ffi::c_char)>;
472/// Gets an id that uniquely identifies current isolate group.
473///
474/// It is the responsibility of the caller to free the returned ID.
475pub type Dart_IsolateGroupId = i64;
476pub type Dart_HeapSamplingReportCallback =
477 ::core::option::Option<unsafe extern "C" fn(context: *mut ::core::ffi::c_void, data: *mut ::core::ffi::c_void)>;
478pub type Dart_HeapSamplingCreateCallback = ::core::option::Option<
479 unsafe extern "C" fn(
480 isolate: Dart_Isolate,
481 isolate_group: Dart_IsolateGroup,
482 cls_name: *const ::core::ffi::c_char,
483 allocation_size: isize,
484 ) -> *mut ::core::ffi::c_void,
485>;
486pub type Dart_HeapSamplingDeleteCallback = ::core::option::Option<unsafe extern "C" fn(data: *mut ::core::ffi::c_void)>;
487/// A port is used to send or receive inter-isolate messages
488pub type Dart_Port = i64;
489/// A message notification callback.
490///
491/// This callback allows the embedder to provide a custom wakeup mechanism for
492/// the delivery of inter-isolate messages. This function is called once per
493/// message on an arbitrary thread. It is the responsibility of the embedder to
494/// eventually call Dart_HandleMessage once per callback received with the
495/// destination isolate set as the current isolate to process the message.
496pub type Dart_MessageNotifyCallback = ::core::option::Option<unsafe extern "C" fn(destination_isolate: Dart_Isolate)>;
497/// The arguments to a native function.
498///
499/// This object is passed to a native function to represent its
500/// arguments and return value. It allows access to the arguments to a
501/// native function by index. It also allows the return value of a
502/// native function to be set.
503pub type Dart_NativeArguments = *mut _Dart_NativeArguments;
504pub type Dart_NativeArgument_Descriptor = _Dart_NativeArgument_Descriptor;
505pub type Dart_NativeArgument_Value = _Dart_NativeArgument_Value;
506/// A native function.
507pub type Dart_NativeFunction = ::core::option::Option<unsafe extern "C" fn(arguments: Dart_NativeArguments)>;
508/// Native entry resolution callback.
509///
510/// For libraries and scripts which have native functions, the embedder
511/// can provide a native entry resolver. This callback is used to map a
512/// name/arity to a Dart_NativeFunction. If no function is found, the
513/// callback should return NULL.
514///
515/// The parameters to the native resolver function are:
516/// \param name a Dart string which is the name of the native function.
517/// \param num_of_arguments is the number of arguments expected by the
518/// native function.
519/// \param auto_setup_scope is a boolean flag that can be set by the resolver
520/// to indicate if this function needs a Dart API scope (see Dart_EnterScope/
521/// Dart_ExitScope) to be setup automatically by the VM before calling into
522/// the native function. By default most native functions would require this
523/// to be true but some light weight native functions which do not call back
524/// into the VM through the Dart API may not require a Dart scope to be
525/// setup automatically.
526///
527/// \return A valid Dart_NativeFunction which resolves to a native entry point
528/// for the native function.
529///
530/// See Dart_SetNativeResolver.
531pub type Dart_NativeEntryResolver = ::core::option::Option<
532 unsafe extern "C" fn(
533 name: Dart_Handle,
534 num_of_arguments: ::core::ffi::c_int,
535 auto_setup_scope: *mut bool,
536 ) -> Dart_NativeFunction,
537>;
538/// Native entry symbol lookup callback.
539///
540/// For libraries and scripts which have native functions, the embedder
541/// can provide a callback for mapping a native entry to a symbol. This callback
542/// maps a native function entry PC to the native function name. If no native
543/// entry symbol can be found, the callback should return NULL.
544///
545/// The parameters to the native reverse resolver function are:
546/// \param nf A Dart_NativeFunction.
547///
548/// \return A const UTF-8 string containing the symbol name or NULL.
549///
550/// See Dart_SetNativeResolver.
551pub type Dart_NativeEntrySymbol = ::core::option::Option<unsafe extern "C" fn(nf: Dart_NativeFunction) -> *const u8>;
552/// FFI Native C function pointer resolver callback.
553///
554/// See Dart_SetFfiNativeResolver.
555pub type Dart_FfiNativeResolver = ::core::option::Option<
556 unsafe extern "C" fn(name: *const ::core::ffi::c_char, args_n: usize) -> *mut ::core::ffi::c_void,
557>;
558/// An environment lookup callback function.
559///
560/// \param name The name of the value to lookup in the environment.
561///
562/// \return A valid handle to a string if the name exists in the
563/// current environment or Dart_Null() if not.
564pub type Dart_EnvironmentCallback = ::core::option::Option<unsafe extern "C" fn(name: Dart_Handle) -> Dart_Handle>;
565/// The library tag handler is a multi-purpose callback provided by the
566/// embedder to the Dart VM. The embedder implements the tag handler to
567/// provide the ability to load Dart scripts and imports.
568///
569/// -- TAGS --
570///
571/// Dart_kCanonicalizeUrl
572///
573/// This tag indicates that the embedder should canonicalize 'url' with
574/// respect to 'library'. For most embedders, the
575/// Dart_DefaultCanonicalizeUrl function is a sufficient implementation
576/// of this tag. The return value should be a string holding the
577/// canonicalized url.
578///
579/// Dart_kImportTag
580///
581/// This tag is used to load a library from IsolateMirror.loadUri. The embedder
582/// should call Dart_LoadLibraryFromKernel to provide the library to the VM. The
583/// return value should be an error or library (the result from
584/// Dart_LoadLibraryFromKernel).
585///
586/// Dart_kKernelTag
587///
588/// This tag is used to load the intermediate file (kernel) generated by
589/// the Dart front end. This tag is typically used when a 'hot-reload'
590/// of an application is needed and the VM is 'use dart front end' mode.
591/// The dart front end typically compiles all the scripts, imports and part
592/// files into one intermediate file hence we don't use the source/import or
593/// script tags. The return value should be an error or a TypedData containing
594/// the kernel bytes.
595pub type Dart_LibraryTagHandler = ::core::option::Option<
596 unsafe extern "C" fn(
597 tag: Dart_LibraryTag,
598 library_or_package_map_url: Dart_Handle,
599 url: Dart_Handle,
600 ) -> Dart_Handle,
601>;
602/// Handles deferred loading requests. When this handler is invoked, it should
603/// eventually load the deferred loading unit with the given id and call
604/// Dart_DeferredLoadComplete or Dart_DeferredLoadCompleteError. It is
605/// recommended that the loading occur asynchronously, but it is permitted to
606/// call Dart_DeferredLoadComplete or Dart_DeferredLoadCompleteError before the
607/// handler returns.
608///
609/// If an error is returned, it will be propagated through
610/// `prefix.loadLibrary()`. This is useful for synchronous
611/// implementations, which must propagate any unwind errors from
612/// Dart_DeferredLoadComplete or Dart_DeferredLoadComplete. Otherwise the handler
613/// should return a non-error such as `Dart_Null()`.
614pub type Dart_DeferredLoadHandler = ::core::option::Option<unsafe extern "C" fn(loading_unit_id: isize) -> Dart_Handle>;
615pub type Dart_CreateLoadingUnitCallback = ::core::option::Option<
616 unsafe extern "C" fn(
617 callback_data: *mut ::core::ffi::c_void,
618 loading_unit_id: isize,
619 write_callback_data: *mut *mut ::core::ffi::c_void,
620 write_debug_callback_data: *mut *mut ::core::ffi::c_void,
621 ),
622>;
623pub type Dart_StreamingWriteCallback = ::core::option::Option<
624 unsafe extern "C" fn(callback_data: *mut ::core::ffi::c_void, buffer: *const u8, size: isize),
625>;
626pub type Dart_StreamingCloseCallback =
627 ::core::option::Option<unsafe extern "C" fn(callback_data: *mut ::core::ffi::c_void)>;
628/// Callback provided by the embedder that is used by the VM to
629/// produce footnotes appended to DWARF stack traces.
630///
631/// Whenever VM formats a stack trace as a string it would call this callback
632/// passing raw program counters for each frame in the stack trace.
633///
634/// Embedder can then return a string which if not-null will be appended to the
635/// formatted stack trace.
636///
637/// Returned string is expected to be `malloc()` allocated. VM takes ownership
638/// of the returned string and will `free()` it.
639///
640/// \param addresses raw program counter addresses for each frame
641/// \param count number of elements in the addresses array
642pub type Dart_DwarfStackTraceFootnoteCallback = ::core::option::Option<
643 unsafe extern "C" fn(addresses: *mut *mut ::core::ffi::c_void, count: isize) -> *mut ::core::ffi::c_char,
644>;
645pub type Dart_CObject = _Dart_CObject;
646/// A native message handler.
647///
648/// This handler is associated with a native port by calling
649/// Dart_NewNativePort.
650///
651/// The message received is decoded into the message structure. The
652/// lifetime of the message data is controlled by the caller. All the
653/// data references from the message are allocated by the caller and
654/// will be reclaimed when returning to it.
655pub type Dart_NativeMessageHandler =
656 ::core::option::Option<unsafe extern "C" fn(dest_port_id: Dart_Port, message: *mut Dart_CObject)>;
657pub type Dart_Port_DL = i64;
658pub type Dart_NativeMessageHandler_DL =
659 ::core::option::Option<unsafe extern "C" fn(dest_port_id: Dart_Port_DL, message: *mut Dart_CObject)>;
660pub type Dart_PostCObject_Type =
661 ::core::option::Option<unsafe extern "C" fn(port_id: Dart_Port_DL, message: *mut Dart_CObject) -> bool>;
662pub type Dart_PostInteger_Type =
663 ::core::option::Option<unsafe extern "C" fn(port_id: Dart_Port_DL, message: i64) -> bool>;
664pub type Dart_NewNativePort_Type = ::core::option::Option<
665 unsafe extern "C" fn(
666 name: *const ::core::ffi::c_char,
667 handler: Dart_NativeMessageHandler_DL,
668 handle_concurrently: bool,
669 ) -> Dart_Port_DL,
670>;
671pub type Dart_CloseNativePort_Type = ::core::option::Option<unsafe extern "C" fn(native_port_id: Dart_Port_DL) -> bool>;
672pub type Dart_IsError_Type = ::core::option::Option<unsafe extern "C" fn(handle: Dart_Handle) -> bool>;
673pub type Dart_IsApiError_Type = ::core::option::Option<unsafe extern "C" fn(handle: Dart_Handle) -> bool>;
674pub type Dart_IsUnhandledExceptionError_Type =
675 ::core::option::Option<unsafe extern "C" fn(handle: Dart_Handle) -> bool>;
676pub type Dart_IsCompilationError_Type = ::core::option::Option<unsafe extern "C" fn(handle: Dart_Handle) -> bool>;
677pub type Dart_IsFatalError_Type = ::core::option::Option<unsafe extern "C" fn(handle: Dart_Handle) -> bool>;
678pub type Dart_GetError_Type =
679 ::core::option::Option<unsafe extern "C" fn(handle: Dart_Handle) -> *const ::core::ffi::c_char>;
680pub type Dart_ErrorHasException_Type = ::core::option::Option<unsafe extern "C" fn(handle: Dart_Handle) -> bool>;
681pub type Dart_ErrorGetException_Type = ::core::option::Option<unsafe extern "C" fn(handle: Dart_Handle) -> Dart_Handle>;
682pub type Dart_ErrorGetStackTrace_Type =
683 ::core::option::Option<unsafe extern "C" fn(handle: Dart_Handle) -> Dart_Handle>;
684pub type Dart_NewApiError_Type =
685 ::core::option::Option<unsafe extern "C" fn(error: *const ::core::ffi::c_char) -> Dart_Handle>;
686pub type Dart_NewCompilationError_Type =
687 ::core::option::Option<unsafe extern "C" fn(error: *const ::core::ffi::c_char) -> Dart_Handle>;
688pub type Dart_NewUnhandledExceptionError_Type =
689 ::core::option::Option<unsafe extern "C" fn(exception: Dart_Handle) -> Dart_Handle>;
690pub type Dart_PropagateError_Type = ::core::option::Option<unsafe extern "C" fn(handle: Dart_Handle)>;
691pub type Dart_HandleFromPersistent_Type =
692 ::core::option::Option<unsafe extern "C" fn(object: Dart_PersistentHandle) -> Dart_Handle>;
693pub type Dart_HandleFromWeakPersistent_Type =
694 ::core::option::Option<unsafe extern "C" fn(object: Dart_WeakPersistentHandle) -> Dart_Handle>;
695pub type Dart_NewPersistentHandle_Type =
696 ::core::option::Option<unsafe extern "C" fn(object: Dart_Handle) -> Dart_PersistentHandle>;
697pub type Dart_SetPersistentHandle_Type =
698 ::core::option::Option<unsafe extern "C" fn(obj1: Dart_PersistentHandle, obj2: Dart_Handle)>;
699pub type Dart_DeletePersistentHandle_Type = ::core::option::Option<unsafe extern "C" fn(object: Dart_PersistentHandle)>;
700pub type Dart_NewWeakPersistentHandle_Type = ::core::option::Option<
701 unsafe extern "C" fn(
702 object: Dart_Handle,
703 peer: *mut ::core::ffi::c_void,
704 external_allocation_size: isize,
705 callback: Dart_HandleFinalizer,
706 ) -> Dart_WeakPersistentHandle,
707>;
708pub type Dart_DeleteWeakPersistentHandle_Type =
709 ::core::option::Option<unsafe extern "C" fn(object: Dart_WeakPersistentHandle)>;
710pub type Dart_NewFinalizableHandle_Type = ::core::option::Option<
711 unsafe extern "C" fn(
712 object: Dart_Handle,
713 peer: *mut ::core::ffi::c_void,
714 external_allocation_size: isize,
715 callback: Dart_HandleFinalizer,
716 ) -> Dart_FinalizableHandle,
717>;
718pub type Dart_DeleteFinalizableHandle_Type =
719 ::core::option::Option<unsafe extern "C" fn(object: Dart_FinalizableHandle, strong_ref_to_object: Dart_Handle)>;
720pub type Dart_CurrentIsolate_Type = ::core::option::Option<unsafe extern "C" fn() -> Dart_Isolate>;
721pub type Dart_ExitIsolate_Type = ::core::option::Option<unsafe extern "C" fn()>;
722pub type Dart_EnterIsolate_Type = ::core::option::Option<unsafe extern "C" fn(arg1: Dart_Isolate)>;
723pub type Dart_Post_Type =
724 ::core::option::Option<unsafe extern "C" fn(port_id: Dart_Port_DL, object: Dart_Handle) -> bool>;
725pub type Dart_NewSendPort_Type = ::core::option::Option<unsafe extern "C" fn(port_id: Dart_Port_DL) -> Dart_Handle>;
726pub type Dart_SendPortGetId_Type =
727 ::core::option::Option<unsafe extern "C" fn(port: Dart_Handle, port_id: *mut Dart_Port_DL) -> Dart_Handle>;
728pub type Dart_EnterScope_Type = ::core::option::Option<unsafe extern "C" fn()>;
729pub type Dart_ExitScope_Type = ::core::option::Option<unsafe extern "C" fn()>;
730pub type Dart_IsNull_Type = ::core::option::Option<unsafe extern "C" fn(arg1: Dart_Handle) -> bool>;
731pub type Dart_UpdateExternalSize_Type =
732 ::core::option::Option<unsafe extern "C" fn(object: Dart_WeakPersistentHandle, external_allocation_size: isize)>;
733pub type Dart_UpdateFinalizableExternalSize_Type = ::core::option::Option<
734 unsafe extern "C" fn(
735 object: Dart_FinalizableHandle,
736 strong_ref_to_object: Dart_Handle,
737 external_allocation_size: isize,
738 ),
739>;
740/// A service request callback function.
741///
742/// These callbacks, registered by the embedder, are called when the VM receives
743/// a service request it can't handle and the service request command name
744/// matches one of the embedder registered handlers.
745///
746/// The return value of the callback indicates whether the response
747/// should be used as a regular result or an error result.
748/// Specifically, if the callback returns true, a regular JSON-RPC
749/// response is built in the following way:
750///
751/// {
752/// "jsonrpc": "2.0",
753/// "result": <json_object>,
754/// "id": <some sequence id>,
755/// }
756///
757/// If the callback returns false, a JSON-RPC error is built like this:
758///
759/// {
760/// "jsonrpc": "2.0",
761/// "error": <json_object>,
762/// "id": <some sequence id>,
763/// }
764///
765/// \param method The rpc method name.
766/// \param param_keys Service requests can have key-value pair parameters. The
767/// keys and values are flattened and stored in arrays.
768/// \param param_values The values associated with the keys.
769/// \param num_params The length of the param_keys and param_values arrays.
770/// \param user_data The user_data pointer registered with this handler.
771/// \param result A C string containing a valid JSON object. The returned
772/// pointer will be freed by the VM by calling free.
773///
774/// \return True if the result is a regular JSON-RPC response, false if the
775/// result is a JSON-RPC error.
776pub type Dart_ServiceRequestCallback = ::core::option::Option<
777 unsafe extern "C" fn(
778 method: *const ::core::ffi::c_char,
779 param_keys: *mut *const ::core::ffi::c_char,
780 param_values: *mut *const ::core::ffi::c_char,
781 num_params: isize,
782 user_data: *mut ::core::ffi::c_void,
783 json_object: *mut *const ::core::ffi::c_char,
784 ) -> bool,
785>;
786/// Callback provided by the embedder that is used by the VM to request
787/// information.
788///
789/// \return Returns a pointer to a Dart_EmbedderInformation structure.
790/// The embedder keeps the ownership of the structure and any field in it.
791/// The embedder must ensure that the structure will remain valid until the
792/// next invocation of the callback.
793pub type Dart_EmbedderInformationCallback =
794 ::core::option::Option<unsafe extern "C" fn(info: *mut Dart_EmbedderInformation)>;
795/// A callback invoked when the VM service gets a request to listen to
796/// some stream.
797///
798/// \return Returns true iff the embedder supports the named stream id.
799pub type Dart_ServiceStreamListenCallback =
800 ::core::option::Option<unsafe extern "C" fn(stream_id: *const ::core::ffi::c_char) -> bool>;
801/// A callback invoked when the VM service gets a request to cancel
802/// some stream.
803pub type Dart_ServiceStreamCancelCallback =
804 ::core::option::Option<unsafe extern "C" fn(stream_id: *const ::core::ffi::c_char)>;
805/// A callback which determines whether the file at some url has been
806/// modified since some time. If the file cannot be found, true should
807/// be returned.
808pub type Dart_FileModifiedCallback =
809 ::core::option::Option<unsafe extern "C" fn(url: *const ::core::ffi::c_char, since: i64) -> bool>;
810/// Callback provided by the embedder to handle the completion of timeline
811/// events.
812///
813/// \param event A timeline event that has just been completed. The VM keeps
814/// ownership of the event and any field in it (i.e., the embedder should copy
815/// any values it needs after the callback returns).
816pub type Dart_TimelineRecorderCallback =
817 ::core::option::Option<unsafe extern "C" fn(event: *mut Dart_TimelineRecorderEvent)>;
818/// Callback provided by the caller of `Dart_WriteHeapSnapshot` which is
819/// used to write out chunks of the requested heap snapshot.
820///
821/// \param context An opaque context which was passed to `Dart_WriteHeapSnapshot`
822/// together with this callback.
823///
824/// \param buffer Pointer to the buffer containing a chunk of the snapshot.
825/// The callback owns the buffer and needs to `free` it.
826///
827/// \param size Number of bytes in the `buffer` to be written.
828///
829/// \param is_last Set to `true` for the last chunk. The callback will not
830/// be invoked again after it was invoked once with `is_last` set to `true`.
831pub type Dart_HeapSnapshotWriteChunkCallback = ::core::option::Option<
832 unsafe extern "C" fn(context: *mut ::core::ffi::c_void, buffer: *mut u8, size: isize, is_last: bool),
833>;
834#[repr(C)]
835#[derive(Debug, Copy, Clone)]
836pub struct __crt_locale_data_public {
837 pub _locale_pctype: *const ::core::ffi::c_ushort,
838 pub _locale_mb_cur_max: ::core::ffi::c_int,
839 pub _locale_lc_codepage: ::core::ffi::c_uint,
840}
841#[repr(C)]
842#[derive(Debug, Copy, Clone)]
843pub struct __crt_locale_pointers {
844 pub locinfo: *mut __crt_locale_data,
845 pub mbcinfo: *mut __crt_multibyte_data,
846}
847#[repr(C)]
848#[derive(Debug, Copy, Clone)]
849pub struct _Mbstatet {
850 pub _Wchar: ::core::ffi::c_ulong,
851 pub _Byte: ::core::ffi::c_ushort,
852 pub _State: ::core::ffi::c_ushort,
853}
854#[repr(C)]
855#[derive(Debug, Copy, Clone)]
856pub struct _Lldiv_t {
857 pub quot: intmax_t,
858 pub rem: intmax_t,
859}
860#[repr(C)]
861#[derive(Debug, Copy, Clone)]
862pub struct _Dart_Isolate {
863 _unused: [u8; 0],
864}
865#[repr(C)]
866#[derive(Debug, Copy, Clone)]
867pub struct _Dart_IsolateGroup {
868 _unused: [u8; 0],
869}
870#[repr(C)]
871#[derive(Debug, Copy, Clone)]
872pub struct _Dart_Handle {
873 _unused: [u8; 0],
874}
875#[repr(C)]
876#[derive(Debug, Copy, Clone)]
877pub struct _Dart_WeakPersistentHandle {
878 _unused: [u8; 0],
879}
880#[repr(C)]
881#[derive(Debug, Copy, Clone)]
882pub struct _Dart_FinalizableHandle {
883 _unused: [u8; 0],
884}
885#[repr(C)]
886#[derive(Debug, Copy, Clone)]
887pub struct Dart_IsolateFlags {
888 pub version: i32,
889 pub enable_asserts: bool,
890 pub use_field_guards: bool,
891 pub use_osr: bool,
892 pub obfuscate: bool,
893 pub load_vmservice_library: bool,
894 pub copy_parent_code: bool,
895 pub null_safety: bool,
896 pub is_system_isolate: bool,
897 pub snapshot_is_dontneed_safe: bool,
898 pub branch_coverage: bool,
899}
900/// Forward declaration
901#[repr(C)]
902#[derive(Debug, Copy, Clone)]
903pub struct Dart_CodeObserver {
904 pub data: *mut ::core::ffi::c_void,
905 pub on_new_code: Dart_OnNewCodeCallback,
906}
907/// Describes how to initialize the VM. Used with Dart_Initialize.
908#[repr(C)]
909#[derive(Debug, Copy, Clone)]
910pub struct Dart_InitializeParams {
911 /// Identifies the version of the struct used by the client.
912 /// should be initialized to DART_INITIALIZE_PARAMS_CURRENT_VERSION.
913 pub version: i32,
914 /// A buffer containing snapshot data, or NULL if no snapshot is provided.
915 ///
916 /// If provided, the buffer must remain valid until Dart_Cleanup returns.
917 pub vm_snapshot_data: *const u8,
918 /// A buffer containing a snapshot of precompiled instructions, or NULL if
919 /// no snapshot is provided.
920 ///
921 /// If provided, the buffer must remain valid until Dart_Cleanup returns.
922 pub vm_snapshot_instructions: *const u8,
923 /// A function to be called during isolate group creation.
924 /// See Dart_IsolateGroupCreateCallback.
925 pub create_group: Dart_IsolateGroupCreateCallback,
926 /// A function to be called during isolate
927 /// initialization inside an existing isolate group.
928 /// See Dart_InitializeIsolateCallback.
929 pub initialize_isolate: Dart_InitializeIsolateCallback,
930 /// A function to be called right before an isolate is shutdown.
931 /// See Dart_IsolateShutdownCallback.
932 pub shutdown_isolate: Dart_IsolateShutdownCallback,
933 /// A function to be called after an isolate was shutdown.
934 /// See Dart_IsolateCleanupCallback.
935 pub cleanup_isolate: Dart_IsolateCleanupCallback,
936 /// A function to be called after an isolate group is
937 /// shutdown. See Dart_IsolateGroupCleanupCallback.
938 pub cleanup_group: Dart_IsolateGroupCleanupCallback,
939 pub thread_start: Dart_ThreadStartCallback,
940 pub thread_exit: Dart_ThreadExitCallback,
941 pub file_open: Dart_FileOpenCallback,
942 pub file_read: Dart_FileReadCallback,
943 pub file_write: Dart_FileWriteCallback,
944 pub file_close: Dart_FileCloseCallback,
945 pub entropy_source: Dart_EntropySource,
946 /// A function to be called by the service isolate when it requires the
947 /// vmservice assets archive. See Dart_GetVMServiceAssetsArchive.
948 pub get_service_assets: Dart_GetVMServiceAssetsArchive,
949 pub start_kernel_isolate: bool,
950 /// An external code observer callback function. The observer can be invoked
951 /// as early as during the Dart_Initialize() call.
952 pub code_observer: *mut Dart_CodeObserver,
953 /// Kernel blob registration callback function. See Dart_RegisterKernelBlobCallback.
954 pub register_kernel_blob: Dart_RegisterKernelBlobCallback,
955 /// Kernel blob unregistration callback function. See Dart_UnregisterKernelBlobCallback.
956 pub unregister_kernel_blob: Dart_UnregisterKernelBlobCallback,
957}
958#[repr(transparent)]
959#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
960pub struct Dart_PerformanceMode(pub ::core::ffi::c_int);
961#[repr(transparent)]
962#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
963pub struct Dart_CoreType_Id(pub ::core::ffi::c_int);
964#[repr(transparent)]
965#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
966pub struct Dart_TypedData_Type(pub ::core::ffi::c_int);
967#[repr(C)]
968#[derive(Debug, Copy, Clone)]
969pub struct _Dart_NativeArguments {
970 _unused: [u8; 0],
971}
972#[repr(transparent)]
973#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
974pub struct Dart_NativeArgument_Type(pub ::core::ffi::c_int);
975#[repr(C)]
976#[derive(Debug, Copy, Clone)]
977pub struct _Dart_NativeArgument_Descriptor {
978 pub type_: u8,
979 pub index: u8,
980}
981#[repr(C)]
982#[derive(Debug, Copy, Clone)]
983pub struct _Dart_NativeArgument_Value__bindgen_ty_1 {
984 pub dart_str: Dart_Handle,
985 pub peer: *mut ::core::ffi::c_void,
986}
987#[repr(C)]
988#[derive(Debug, Copy, Clone)]
989pub struct _Dart_NativeArgument_Value__bindgen_ty_2 {
990 pub num_fields: isize,
991 pub values: *mut isize,
992}
993#[repr(transparent)]
994#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
995pub struct _bindgen_ty_1(pub ::core::ffi::c_int);
996#[repr(transparent)]
997#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
998pub struct Dart_LibraryTag(pub ::core::ffi::c_int);
999#[repr(transparent)]
1000/// Experimental support for Dart to Kernel parser isolate.
1001///
1002/// TODO(hausner): Document finalized interface.
1003#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1004pub struct Dart_KernelCompilationStatus(pub ::core::ffi::c_int);
1005#[repr(C)]
1006#[derive(Debug, Copy, Clone)]
1007pub struct Dart_KernelCompilationResult {
1008 pub status: Dart_KernelCompilationStatus,
1009 pub null_safety: bool,
1010 pub error: *mut ::core::ffi::c_char,
1011 pub kernel: *mut u8,
1012 pub kernel_size: isize,
1013}
1014#[repr(transparent)]
1015#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1016pub struct Dart_KernelCompilationVerbosityLevel(pub ::core::ffi::c_int);
1017#[repr(C)]
1018#[derive(Debug, Copy, Clone)]
1019pub struct Dart_SourceFile {
1020 pub uri: *const ::core::ffi::c_char,
1021 pub source: *const ::core::ffi::c_char,
1022}
1023#[repr(transparent)]
1024/// A Dart_CObject is used for representing Dart objects as native C
1025/// data outside the Dart heap. These objects are totally detached from
1026/// the Dart heap. Only a subset of the Dart objects have a
1027/// representation as a Dart_CObject.
1028///
1029/// The string encoding in the 'value.as_string' is UTF-8.
1030///
1031/// All the different types from dart:typed_data are exposed as type
1032/// kTypedData. The specific type from dart:typed_data is in the type
1033/// field of the as_typed_data structure. The length in the
1034/// as_typed_data structure is always in bytes.
1035///
1036/// The data for kTypedData is copied on message send and ownership remains with
1037/// the caller. The ownership of data for kExternalTyped is passed to the VM on
1038/// message send and returned when the VM invokes the
1039/// Dart_HandleFinalizer callback; a non-NULL callback must be provided.
1040///
1041/// Note that Dart_CObject_kNativePointer is intended for internal use by
1042/// dart:io implementation and has no connection to dart:ffi Pointer class.
1043/// It represents a pointer to a native resource of a known type.
1044/// The receiving side will only see this pointer as an integer and will not
1045/// see the specified finalizer.
1046/// The specified finalizer will only be invoked if the message is not delivered.
1047#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1048pub struct Dart_CObject_Type(pub ::core::ffi::c_int);
1049#[repr(C)]
1050#[derive(Copy, Clone)]
1051pub struct _Dart_CObject {
1052 pub type_: Dart_CObject_Type,
1053 pub value: _Dart_CObject__bindgen_ty_1,
1054}
1055#[repr(C)]
1056#[derive(Debug, Copy, Clone)]
1057pub struct _Dart_CObject__bindgen_ty_1__bindgen_ty_1 {
1058 pub id: Dart_Port,
1059 pub origin_id: Dart_Port,
1060}
1061#[repr(C)]
1062#[derive(Debug, Copy, Clone)]
1063pub struct _Dart_CObject__bindgen_ty_1__bindgen_ty_2 {
1064 pub id: i64,
1065}
1066#[repr(C)]
1067#[derive(Debug, Copy, Clone)]
1068pub struct _Dart_CObject__bindgen_ty_1__bindgen_ty_3 {
1069 pub length: isize,
1070 pub values: *mut *mut _Dart_CObject,
1071}
1072#[repr(C)]
1073#[derive(Debug, Copy, Clone)]
1074pub struct _Dart_CObject__bindgen_ty_1__bindgen_ty_4 {
1075 pub type_: Dart_TypedData_Type,
1076 pub length: isize,
1077 pub values: *const u8,
1078}
1079#[repr(C)]
1080#[derive(Debug, Copy, Clone)]
1081pub struct _Dart_CObject__bindgen_ty_1__bindgen_ty_5 {
1082 pub type_: Dart_TypedData_Type,
1083 pub length: isize,
1084 pub data: *mut u8,
1085 pub peer: *mut ::core::ffi::c_void,
1086 pub callback: Dart_HandleFinalizer,
1087}
1088#[repr(C)]
1089#[derive(Debug, Copy, Clone)]
1090pub struct _Dart_CObject__bindgen_ty_1__bindgen_ty_6 {
1091 pub ptr: isize,
1092 pub size: isize,
1093 pub callback: Dart_HandleFinalizer,
1094}
1095#[repr(C)]
1096#[derive(Debug, Copy, Clone)]
1097pub struct Dart_EmbedderInformation {
1098 pub version: i32,
1099 pub name: *const ::core::ffi::c_char,
1100 pub current_rss: i64,
1101 pub max_rss: i64,
1102}
1103#[repr(transparent)]
1104#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1105pub struct Dart_Timeline_Event_Type(pub ::core::ffi::c_int);
1106#[repr(C)]
1107#[derive(Debug, Copy, Clone)]
1108pub struct Dart_TimelineRecorderEvent_Argument {
1109 pub name: *const ::core::ffi::c_char,
1110 pub value: *const ::core::ffi::c_char,
1111}
1112#[repr(C)]
1113#[derive(Debug, Copy, Clone)]
1114pub struct Dart_TimelineRecorderEvent {
1115 pub version: i32,
1116 pub type_: Dart_Timeline_Event_Type,
1117 pub timestamp0: i64,
1118 /// For a duration event, this is the end time. For an async event, this is the
1119 /// async ID. For a flow event, this is the flow ID. For a begin or end event,
1120 /// this is the event ID (which is only referenced by the MacOS recorder).
1121 pub timestamp1_or_id: i64,
1122 pub isolate: Dart_Port,
1123 pub isolate_group: Dart_IsolateGroupId,
1124 pub isolate_data: *mut ::core::ffi::c_void,
1125 pub isolate_group_data: *mut ::core::ffi::c_void,
1126 pub label: *const ::core::ffi::c_char,
1127 pub stream: *const ::core::ffi::c_char,
1128 pub argument_count: isize,
1129 pub arguments: *mut Dart_TimelineRecorderEvent_Argument,
1130}
1131#[repr(C)]
1132#[derive(Debug, Copy, Clone)]
1133pub struct __crt_locale_data {
1134 pub _address: u8,
1135}
1136#[repr(C)]
1137#[derive(Debug, Copy, Clone)]
1138pub struct __crt_multibyte_data {
1139 pub _address: u8,
1140}
1141pub const _VCRT_COMPILER_PREPROCESSOR: u32 = 1;
1142pub const _SAL_VERSION: u32 = 20;
1143pub const __SAL_H_VERSION: u32 = 180000000;
1144pub const _USE_DECLSPECS_FOR_SAL: u32 = 0;
1145pub const _USE_ATTRIBUTES_FOR_SAL: u32 = 0;
1146pub const _CRT_PACKING: u32 = 8;
1147pub const _HAS_EXCEPTIONS: u32 = 1;
1148pub const _STL_LANG: u32 = 0;
1149pub const _HAS_CXX17: u32 = 0;
1150pub const _HAS_CXX20: u32 = 0;
1151pub const _HAS_CXX23: u32 = 0;
1152pub const _HAS_NODISCARD: u32 = 0;
1153pub const _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE: u32 = 1;
1154pub const _CRT_BUILD_DESKTOP_APP: u32 = 1;
1155pub const _ARGMAX: u32 = 100;
1156pub const _CRT_INT_MAX: u32 = 2147483647;
1157pub const _CRT_FUNCTIONS_REQUIRED: u32 = 1;
1158pub const _CRT_HAS_CXX17: u32 = 0;
1159pub const _CRT_HAS_C11: u32 = 1;
1160pub const _CRT_INTERNAL_NONSTDC_NAMES: u32 = 1;
1161pub const __STDC_SECURE_LIB__: u32 = 200411;
1162pub const __GOT_SECURE_LIB__: u32 = 200411;
1163pub const __STDC_WANT_SECURE_LIB__: u32 = 1;
1164pub const _SECURECRT_FILL_BUFFER_PATTERN: u32 = 254;
1165pub const _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES: u32 = 0;
1166pub const _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT: u32 = 0;
1167pub const _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES: u32 = 1;
1168pub const _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY: u32 = 0;
1169pub const _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY: u32 = 0;
1170pub const WCHAR_MIN: u32 = 0;
1171pub const WCHAR_MAX: u32 = 65535;
1172pub const WINT_MIN: u32 = 0;
1173pub const WINT_MAX: u32 = 65535;
1174pub const PRId8: &[u8; 4] = b"hhd\0";
1175pub const PRId16: &[u8; 3] = b"hd\0";
1176pub const PRId32: &[u8; 2] = b"d\0";
1177pub const PRId64: &[u8; 4] = b"lld\0";
1178pub const PRIdLEAST8: &[u8; 4] = b"hhd\0";
1179pub const PRIdLEAST16: &[u8; 3] = b"hd\0";
1180pub const PRIdLEAST32: &[u8; 2] = b"d\0";
1181pub const PRIdLEAST64: &[u8; 4] = b"lld\0";
1182pub const PRIdFAST8: &[u8; 4] = b"hhd\0";
1183pub const PRIdFAST16: &[u8; 2] = b"d\0";
1184pub const PRIdFAST32: &[u8; 2] = b"d\0";
1185pub const PRIdFAST64: &[u8; 4] = b"lld\0";
1186pub const PRIdMAX: &[u8; 4] = b"lld\0";
1187pub const PRIdPTR: &[u8; 4] = b"lld\0";
1188pub const PRIi8: &[u8; 4] = b"hhi\0";
1189pub const PRIi16: &[u8; 3] = b"hi\0";
1190pub const PRIi32: &[u8; 2] = b"i\0";
1191pub const PRIi64: &[u8; 4] = b"lli\0";
1192pub const PRIiLEAST8: &[u8; 4] = b"hhi\0";
1193pub const PRIiLEAST16: &[u8; 3] = b"hi\0";
1194pub const PRIiLEAST32: &[u8; 2] = b"i\0";
1195pub const PRIiLEAST64: &[u8; 4] = b"lli\0";
1196pub const PRIiFAST8: &[u8; 4] = b"hhi\0";
1197pub const PRIiFAST16: &[u8; 2] = b"i\0";
1198pub const PRIiFAST32: &[u8; 2] = b"i\0";
1199pub const PRIiFAST64: &[u8; 4] = b"lli\0";
1200pub const PRIiMAX: &[u8; 4] = b"lli\0";
1201pub const PRIiPTR: &[u8; 4] = b"lli\0";
1202pub const PRIo8: &[u8; 4] = b"hho\0";
1203pub const PRIo16: &[u8; 3] = b"ho\0";
1204pub const PRIo32: &[u8; 2] = b"o\0";
1205pub const PRIo64: &[u8; 4] = b"llo\0";
1206pub const PRIoLEAST8: &[u8; 4] = b"hho\0";
1207pub const PRIoLEAST16: &[u8; 3] = b"ho\0";
1208pub const PRIoLEAST32: &[u8; 2] = b"o\0";
1209pub const PRIoLEAST64: &[u8; 4] = b"llo\0";
1210pub const PRIoFAST8: &[u8; 4] = b"hho\0";
1211pub const PRIoFAST16: &[u8; 2] = b"o\0";
1212pub const PRIoFAST32: &[u8; 2] = b"o\0";
1213pub const PRIoFAST64: &[u8; 4] = b"llo\0";
1214pub const PRIoMAX: &[u8; 4] = b"llo\0";
1215pub const PRIoPTR: &[u8; 4] = b"llo\0";
1216pub const PRIu8: &[u8; 4] = b"hhu\0";
1217pub const PRIu16: &[u8; 3] = b"hu\0";
1218pub const PRIu32: &[u8; 2] = b"u\0";
1219pub const PRIu64: &[u8; 4] = b"llu\0";
1220pub const PRIuLEAST8: &[u8; 4] = b"hhu\0";
1221pub const PRIuLEAST16: &[u8; 3] = b"hu\0";
1222pub const PRIuLEAST32: &[u8; 2] = b"u\0";
1223pub const PRIuLEAST64: &[u8; 4] = b"llu\0";
1224pub const PRIuFAST8: &[u8; 4] = b"hhu\0";
1225pub const PRIuFAST16: &[u8; 2] = b"u\0";
1226pub const PRIuFAST32: &[u8; 2] = b"u\0";
1227pub const PRIuFAST64: &[u8; 4] = b"llu\0";
1228pub const PRIuMAX: &[u8; 4] = b"llu\0";
1229pub const PRIuPTR: &[u8; 4] = b"llu\0";
1230pub const PRIx8: &[u8; 4] = b"hhx\0";
1231pub const PRIx16: &[u8; 3] = b"hx\0";
1232pub const PRIx32: &[u8; 2] = b"x\0";
1233pub const PRIx64: &[u8; 4] = b"llx\0";
1234pub const PRIxLEAST8: &[u8; 4] = b"hhx\0";
1235pub const PRIxLEAST16: &[u8; 3] = b"hx\0";
1236pub const PRIxLEAST32: &[u8; 2] = b"x\0";
1237pub const PRIxLEAST64: &[u8; 4] = b"llx\0";
1238pub const PRIxFAST8: &[u8; 4] = b"hhx\0";
1239pub const PRIxFAST16: &[u8; 2] = b"x\0";
1240pub const PRIxFAST32: &[u8; 2] = b"x\0";
1241pub const PRIxFAST64: &[u8; 4] = b"llx\0";
1242pub const PRIxMAX: &[u8; 4] = b"llx\0";
1243pub const PRIxPTR: &[u8; 4] = b"llx\0";
1244pub const PRIX8: &[u8; 4] = b"hhX\0";
1245pub const PRIX16: &[u8; 3] = b"hX\0";
1246pub const PRIX32: &[u8; 2] = b"X\0";
1247pub const PRIX64: &[u8; 4] = b"llX\0";
1248pub const PRIXLEAST8: &[u8; 4] = b"hhX\0";
1249pub const PRIXLEAST16: &[u8; 3] = b"hX\0";
1250pub const PRIXLEAST32: &[u8; 2] = b"X\0";
1251pub const PRIXLEAST64: &[u8; 4] = b"llX\0";
1252pub const PRIXFAST8: &[u8; 4] = b"hhX\0";
1253pub const PRIXFAST16: &[u8; 2] = b"X\0";
1254pub const PRIXFAST32: &[u8; 2] = b"X\0";
1255pub const PRIXFAST64: &[u8; 4] = b"llX\0";
1256pub const PRIXMAX: &[u8; 4] = b"llX\0";
1257pub const PRIXPTR: &[u8; 4] = b"llX\0";
1258pub const SCNd8: &[u8; 4] = b"hhd\0";
1259pub const SCNd16: &[u8; 3] = b"hd\0";
1260pub const SCNd32: &[u8; 2] = b"d\0";
1261pub const SCNd64: &[u8; 4] = b"lld\0";
1262pub const SCNdLEAST8: &[u8; 4] = b"hhd\0";
1263pub const SCNdLEAST16: &[u8; 3] = b"hd\0";
1264pub const SCNdLEAST32: &[u8; 2] = b"d\0";
1265pub const SCNdLEAST64: &[u8; 4] = b"lld\0";
1266pub const SCNdFAST8: &[u8; 4] = b"hhd\0";
1267pub const SCNdFAST16: &[u8; 2] = b"d\0";
1268pub const SCNdFAST32: &[u8; 2] = b"d\0";
1269pub const SCNdFAST64: &[u8; 4] = b"lld\0";
1270pub const SCNdMAX: &[u8; 4] = b"lld\0";
1271pub const SCNdPTR: &[u8; 4] = b"lld\0";
1272pub const SCNi8: &[u8; 4] = b"hhi\0";
1273pub const SCNi16: &[u8; 3] = b"hi\0";
1274pub const SCNi32: &[u8; 2] = b"i\0";
1275pub const SCNi64: &[u8; 4] = b"lli\0";
1276pub const SCNiLEAST8: &[u8; 4] = b"hhi\0";
1277pub const SCNiLEAST16: &[u8; 3] = b"hi\0";
1278pub const SCNiLEAST32: &[u8; 2] = b"i\0";
1279pub const SCNiLEAST64: &[u8; 4] = b"lli\0";
1280pub const SCNiFAST8: &[u8; 4] = b"hhi\0";
1281pub const SCNiFAST16: &[u8; 2] = b"i\0";
1282pub const SCNiFAST32: &[u8; 2] = b"i\0";
1283pub const SCNiFAST64: &[u8; 4] = b"lli\0";
1284pub const SCNiMAX: &[u8; 4] = b"lli\0";
1285pub const SCNiPTR: &[u8; 4] = b"lli\0";
1286pub const SCNo8: &[u8; 4] = b"hho\0";
1287pub const SCNo16: &[u8; 3] = b"ho\0";
1288pub const SCNo32: &[u8; 2] = b"o\0";
1289pub const SCNo64: &[u8; 4] = b"llo\0";
1290pub const SCNoLEAST8: &[u8; 4] = b"hho\0";
1291pub const SCNoLEAST16: &[u8; 3] = b"ho\0";
1292pub const SCNoLEAST32: &[u8; 2] = b"o\0";
1293pub const SCNoLEAST64: &[u8; 4] = b"llo\0";
1294pub const SCNoFAST8: &[u8; 4] = b"hho\0";
1295pub const SCNoFAST16: &[u8; 2] = b"o\0";
1296pub const SCNoFAST32: &[u8; 2] = b"o\0";
1297pub const SCNoFAST64: &[u8; 4] = b"llo\0";
1298pub const SCNoMAX: &[u8; 4] = b"llo\0";
1299pub const SCNoPTR: &[u8; 4] = b"llo\0";
1300pub const SCNu8: &[u8; 4] = b"hhu\0";
1301pub const SCNu16: &[u8; 3] = b"hu\0";
1302pub const SCNu32: &[u8; 2] = b"u\0";
1303pub const SCNu64: &[u8; 4] = b"llu\0";
1304pub const SCNuLEAST8: &[u8; 4] = b"hhu\0";
1305pub const SCNuLEAST16: &[u8; 3] = b"hu\0";
1306pub const SCNuLEAST32: &[u8; 2] = b"u\0";
1307pub const SCNuLEAST64: &[u8; 4] = b"llu\0";
1308pub const SCNuFAST8: &[u8; 4] = b"hhu\0";
1309pub const SCNuFAST16: &[u8; 2] = b"u\0";
1310pub const SCNuFAST32: &[u8; 2] = b"u\0";
1311pub const SCNuFAST64: &[u8; 4] = b"llu\0";
1312pub const SCNuMAX: &[u8; 4] = b"llu\0";
1313pub const SCNuPTR: &[u8; 4] = b"llu\0";
1314pub const SCNx8: &[u8; 4] = b"hhx\0";
1315pub const SCNx16: &[u8; 3] = b"hx\0";
1316pub const SCNx32: &[u8; 2] = b"x\0";
1317pub const SCNx64: &[u8; 4] = b"llx\0";
1318pub const SCNxLEAST8: &[u8; 4] = b"hhx\0";
1319pub const SCNxLEAST16: &[u8; 3] = b"hx\0";
1320pub const SCNxLEAST32: &[u8; 2] = b"x\0";
1321pub const SCNxLEAST64: &[u8; 4] = b"llx\0";
1322pub const SCNxFAST8: &[u8; 4] = b"hhx\0";
1323pub const SCNxFAST16: &[u8; 2] = b"x\0";
1324pub const SCNxFAST32: &[u8; 2] = b"x\0";
1325pub const SCNxFAST64: &[u8; 4] = b"llx\0";
1326pub const SCNxMAX: &[u8; 4] = b"llx\0";
1327pub const SCNxPTR: &[u8; 4] = b"llx\0";
1328pub const __bool_true_false_are_defined: u32 = 1;
1329pub const true_: u32 = 1;
1330pub const false_: u32 = 0;
1331pub const DART_FLAGS_CURRENT_VERSION: u32 = 12;
1332pub const DART_INITIALIZE_PARAMS_CURRENT_VERSION: u32 = 8;
1333pub const DART_KERNEL_ISOLATE_NAME: &[u8; 15] = b"kernel-service\0";
1334pub const DART_VM_SERVICE_ISOLATE_NAME: &[u8; 11] = b"vm-service\0";
1335pub const kSnapshotBuildIdCSymbol: &[u8; 22] = b"_kDartSnapshotBuildId\0";
1336pub const kVmSnapshotDataCSymbol: &[u8; 21] = b"_kDartVmSnapshotData\0";
1337pub const kVmSnapshotInstructionsCSymbol: &[u8; 29] = b"_kDartVmSnapshotInstructions\0";
1338pub const kVmSnapshotBssCSymbol: &[u8; 20] = b"_kDartVmSnapshotBss\0";
1339pub const kIsolateSnapshotDataCSymbol: &[u8; 26] = b"_kDartIsolateSnapshotData\0";
1340pub const kIsolateSnapshotInstructionsCSymbol: &[u8; 34] = b"_kDartIsolateSnapshotInstructions\0";
1341pub const kIsolateSnapshotBssCSymbol: &[u8; 25] = b"_kDartIsolateSnapshotBss\0";
1342pub const kSnapshotBuildIdAsmSymbol: &[u8; 22] = b"_kDartSnapshotBuildId\0";
1343pub const kVmSnapshotDataAsmSymbol: &[u8; 21] = b"_kDartVmSnapshotData\0";
1344pub const kVmSnapshotInstructionsAsmSymbol: &[u8; 29] = b"_kDartVmSnapshotInstructions\0";
1345pub const kVmSnapshotBssAsmSymbol: &[u8; 20] = b"_kDartVmSnapshotBss\0";
1346pub const kIsolateSnapshotDataAsmSymbol: &[u8; 26] = b"_kDartIsolateSnapshotData\0";
1347pub const kIsolateSnapshotInstructionsAsmSymbol: &[u8; 34] = b"_kDartIsolateSnapshotInstructions\0";
1348pub const kIsolateSnapshotBssAsmSymbol: &[u8; 25] = b"_kDartIsolateSnapshotBss\0";
1349pub const DART_API_DL_MAJOR_VERSION: u32 = 2;
1350pub const DART_API_DL_MINOR_VERSION: u32 = 3;
1351pub const ILLEGAL_ISOLATE_GROUP_ID: u32 = 0;
1352pub const DART_EMBEDDER_INFORMATION_CURRENT_VERSION: u32 = 1;
1353pub const DART_TIMELINE_RECORDER_CURRENT_VERSION: u32 = 2;
1354/// Balanced
1355pub const Dart_PerformanceMode_Dart_PerformanceMode_Default: Dart_PerformanceMode = Dart_PerformanceMode(0);
1356/// Optimize for low latency, at the expense of throughput and memory overhead
1357/// by performing work in smaller batches (requiring more overhead) or by
1358/// delaying work (requiring more memory). An embedder should not remain in
1359/// this mode indefinitely.
1360pub const Dart_PerformanceMode_Dart_PerformanceMode_Latency: Dart_PerformanceMode = Dart_PerformanceMode(1);
1361/// Optimize for high throughput, at the expense of latency and memory overhead
1362/// by performing work in larger batches with more intervening growth.
1363pub const Dart_PerformanceMode_Dart_PerformanceMode_Throughput: Dart_PerformanceMode = Dart_PerformanceMode(2);
1364/// Optimize for low memory, at the expensive of throughput and latency by more
1365/// frequently performing work.
1366pub const Dart_PerformanceMode_Dart_PerformanceMode_Memory: Dart_PerformanceMode = Dart_PerformanceMode(3);
1367pub const Dart_CoreType_Id_Dart_CoreType_Dynamic: Dart_CoreType_Id = Dart_CoreType_Id(0);
1368pub const Dart_CoreType_Id_Dart_CoreType_Int: Dart_CoreType_Id = Dart_CoreType_Id(1);
1369pub const Dart_CoreType_Id_Dart_CoreType_String: Dart_CoreType_Id = Dart_CoreType_Id(2);
1370pub const Dart_TypedData_Type_Dart_TypedData_kByteData: Dart_TypedData_Type = Dart_TypedData_Type(0);
1371pub const Dart_TypedData_Type_Dart_TypedData_kInt8: Dart_TypedData_Type = Dart_TypedData_Type(1);
1372pub const Dart_TypedData_Type_Dart_TypedData_kUint8: Dart_TypedData_Type = Dart_TypedData_Type(2);
1373pub const Dart_TypedData_Type_Dart_TypedData_kUint8Clamped: Dart_TypedData_Type = Dart_TypedData_Type(3);
1374pub const Dart_TypedData_Type_Dart_TypedData_kInt16: Dart_TypedData_Type = Dart_TypedData_Type(4);
1375pub const Dart_TypedData_Type_Dart_TypedData_kUint16: Dart_TypedData_Type = Dart_TypedData_Type(5);
1376pub const Dart_TypedData_Type_Dart_TypedData_kInt32: Dart_TypedData_Type = Dart_TypedData_Type(6);
1377pub const Dart_TypedData_Type_Dart_TypedData_kUint32: Dart_TypedData_Type = Dart_TypedData_Type(7);
1378pub const Dart_TypedData_Type_Dart_TypedData_kInt64: Dart_TypedData_Type = Dart_TypedData_Type(8);
1379pub const Dart_TypedData_Type_Dart_TypedData_kUint64: Dart_TypedData_Type = Dart_TypedData_Type(9);
1380pub const Dart_TypedData_Type_Dart_TypedData_kFloat32: Dart_TypedData_Type = Dart_TypedData_Type(10);
1381pub const Dart_TypedData_Type_Dart_TypedData_kFloat64: Dart_TypedData_Type = Dart_TypedData_Type(11);
1382pub const Dart_TypedData_Type_Dart_TypedData_kInt32x4: Dart_TypedData_Type = Dart_TypedData_Type(12);
1383pub const Dart_TypedData_Type_Dart_TypedData_kFloat32x4: Dart_TypedData_Type = Dart_TypedData_Type(13);
1384pub const Dart_TypedData_Type_Dart_TypedData_kFloat64x2: Dart_TypedData_Type = Dart_TypedData_Type(14);
1385pub const Dart_TypedData_Type_Dart_TypedData_kInvalid: Dart_TypedData_Type = Dart_TypedData_Type(15);
1386pub const Dart_NativeArgument_Type_Dart_NativeArgument_kBool: Dart_NativeArgument_Type = Dart_NativeArgument_Type(0);
1387pub const Dart_NativeArgument_Type_Dart_NativeArgument_kInt32: Dart_NativeArgument_Type = Dart_NativeArgument_Type(1);
1388pub const Dart_NativeArgument_Type_Dart_NativeArgument_kUint32: Dart_NativeArgument_Type = Dart_NativeArgument_Type(2);
1389pub const Dart_NativeArgument_Type_Dart_NativeArgument_kInt64: Dart_NativeArgument_Type = Dart_NativeArgument_Type(3);
1390pub const Dart_NativeArgument_Type_Dart_NativeArgument_kUint64: Dart_NativeArgument_Type = Dart_NativeArgument_Type(4);
1391pub const Dart_NativeArgument_Type_Dart_NativeArgument_kDouble: Dart_NativeArgument_Type = Dart_NativeArgument_Type(5);
1392pub const Dart_NativeArgument_Type_Dart_NativeArgument_kString: Dart_NativeArgument_Type = Dart_NativeArgument_Type(6);
1393pub const Dart_NativeArgument_Type_Dart_NativeArgument_kInstance: Dart_NativeArgument_Type =
1394 Dart_NativeArgument_Type(7);
1395pub const Dart_NativeArgument_Type_Dart_NativeArgument_kNativeFields: Dart_NativeArgument_Type =
1396 Dart_NativeArgument_Type(8);
1397pub const kNativeArgNumberPos: _bindgen_ty_1 = _bindgen_ty_1(0);
1398pub const kNativeArgNumberSize: _bindgen_ty_1 = _bindgen_ty_1(8);
1399pub const kNativeArgTypePos: _bindgen_ty_1 = _bindgen_ty_1(8);
1400pub const kNativeArgTypeSize: _bindgen_ty_1 = _bindgen_ty_1(8);
1401pub const Dart_LibraryTag_Dart_kCanonicalizeUrl: Dart_LibraryTag = Dart_LibraryTag(0);
1402pub const Dart_LibraryTag_Dart_kImportTag: Dart_LibraryTag = Dart_LibraryTag(1);
1403pub const Dart_LibraryTag_Dart_kKernelTag: Dart_LibraryTag = Dart_LibraryTag(2);
1404pub const Dart_KernelCompilationStatus_Dart_KernelCompilationStatus_Unknown: Dart_KernelCompilationStatus =
1405 Dart_KernelCompilationStatus(-1);
1406pub const Dart_KernelCompilationStatus_Dart_KernelCompilationStatus_Ok: Dart_KernelCompilationStatus =
1407 Dart_KernelCompilationStatus(0);
1408pub const Dart_KernelCompilationStatus_Dart_KernelCompilationStatus_Error: Dart_KernelCompilationStatus =
1409 Dart_KernelCompilationStatus(1);
1410pub const Dart_KernelCompilationStatus_Dart_KernelCompilationStatus_Crash: Dart_KernelCompilationStatus =
1411 Dart_KernelCompilationStatus(2);
1412pub const Dart_KernelCompilationStatus_Dart_KernelCompilationStatus_MsgFailed: Dart_KernelCompilationStatus =
1413 Dart_KernelCompilationStatus(3);
1414pub const Dart_KernelCompilationVerbosityLevel_Dart_KernelCompilationVerbosityLevel_Error:
1415 Dart_KernelCompilationVerbosityLevel = Dart_KernelCompilationVerbosityLevel(0);
1416pub const Dart_KernelCompilationVerbosityLevel_Dart_KernelCompilationVerbosityLevel_Warning:
1417 Dart_KernelCompilationVerbosityLevel = Dart_KernelCompilationVerbosityLevel(1);
1418pub const Dart_KernelCompilationVerbosityLevel_Dart_KernelCompilationVerbosityLevel_Info:
1419 Dart_KernelCompilationVerbosityLevel = Dart_KernelCompilationVerbosityLevel(2);
1420pub const Dart_KernelCompilationVerbosityLevel_Dart_KernelCompilationVerbosityLevel_All:
1421 Dart_KernelCompilationVerbosityLevel = Dart_KernelCompilationVerbosityLevel(3);
1422pub const Dart_CObject_Type_Dart_CObject_kNull: Dart_CObject_Type = Dart_CObject_Type(0);
1423pub const Dart_CObject_Type_Dart_CObject_kBool: Dart_CObject_Type = Dart_CObject_Type(1);
1424pub const Dart_CObject_Type_Dart_CObject_kInt32: Dart_CObject_Type = Dart_CObject_Type(2);
1425pub const Dart_CObject_Type_Dart_CObject_kInt64: Dart_CObject_Type = Dart_CObject_Type(3);
1426pub const Dart_CObject_Type_Dart_CObject_kDouble: Dart_CObject_Type = Dart_CObject_Type(4);
1427pub const Dart_CObject_Type_Dart_CObject_kString: Dart_CObject_Type = Dart_CObject_Type(5);
1428pub const Dart_CObject_Type_Dart_CObject_kArray: Dart_CObject_Type = Dart_CObject_Type(6);
1429pub const Dart_CObject_Type_Dart_CObject_kTypedData: Dart_CObject_Type = Dart_CObject_Type(7);
1430pub const Dart_CObject_Type_Dart_CObject_kExternalTypedData: Dart_CObject_Type = Dart_CObject_Type(8);
1431pub const Dart_CObject_Type_Dart_CObject_kSendPort: Dart_CObject_Type = Dart_CObject_Type(9);
1432pub const Dart_CObject_Type_Dart_CObject_kCapability: Dart_CObject_Type = Dart_CObject_Type(10);
1433pub const Dart_CObject_Type_Dart_CObject_kNativePointer: Dart_CObject_Type = Dart_CObject_Type(11);
1434pub const Dart_CObject_Type_Dart_CObject_kUnsupported: Dart_CObject_Type = Dart_CObject_Type(12);
1435pub const Dart_CObject_Type_Dart_CObject_kUnmodifiableExternalTypedData: Dart_CObject_Type = Dart_CObject_Type(13);
1436pub const Dart_CObject_Type_Dart_CObject_kNumberOfTypes: Dart_CObject_Type = Dart_CObject_Type(14);
1437pub const Dart_Timeline_Event_Type_Dart_Timeline_Event_Begin: Dart_Timeline_Event_Type = Dart_Timeline_Event_Type(0);
1438pub const Dart_Timeline_Event_Type_Dart_Timeline_Event_End: Dart_Timeline_Event_Type = Dart_Timeline_Event_Type(1);
1439pub const Dart_Timeline_Event_Type_Dart_Timeline_Event_Instant: Dart_Timeline_Event_Type = Dart_Timeline_Event_Type(2);
1440pub const Dart_Timeline_Event_Type_Dart_Timeline_Event_Duration: Dart_Timeline_Event_Type = Dart_Timeline_Event_Type(3);
1441pub const Dart_Timeline_Event_Type_Dart_Timeline_Event_Async_Begin: Dart_Timeline_Event_Type =
1442 Dart_Timeline_Event_Type(4);
1443pub const Dart_Timeline_Event_Type_Dart_Timeline_Event_Async_End: Dart_Timeline_Event_Type =
1444 Dart_Timeline_Event_Type(5);
1445pub const Dart_Timeline_Event_Type_Dart_Timeline_Event_Async_Instant: Dart_Timeline_Event_Type =
1446 Dart_Timeline_Event_Type(6);
1447pub const Dart_Timeline_Event_Type_Dart_Timeline_Event_Counter: Dart_Timeline_Event_Type = Dart_Timeline_Event_Type(7);
1448pub const Dart_Timeline_Event_Type_Dart_Timeline_Event_Flow_Begin: Dart_Timeline_Event_Type =
1449 Dart_Timeline_Event_Type(8);
1450pub const Dart_Timeline_Event_Type_Dart_Timeline_Event_Flow_Step: Dart_Timeline_Event_Type =
1451 Dart_Timeline_Event_Type(9);
1452pub const Dart_Timeline_Event_Type_Dart_Timeline_Event_Flow_End: Dart_Timeline_Event_Type =
1453 Dart_Timeline_Event_Type(10);
1454#[repr(C)]
1455#[derive(Copy, Clone)]
1456pub union _Dart_NativeArgument_Value {
1457 pub as_bool: bool,
1458 pub as_int32: i32,
1459 pub as_uint32: u32,
1460 pub as_int64: i64,
1461 pub as_uint64: u64,
1462 pub as_double: f64,
1463 pub as_string: _Dart_NativeArgument_Value__bindgen_ty_1,
1464 pub as_native_fields: _Dart_NativeArgument_Value__bindgen_ty_2,
1465 pub as_instance: Dart_Handle,
1466}
1467#[repr(C)]
1468#[derive(Copy, Clone)]
1469pub union _Dart_CObject__bindgen_ty_1 {
1470 pub as_bool: bool,
1471 pub as_int32: i32,
1472 pub as_int64: i64,
1473 pub as_double: f64,
1474 pub as_string: *const ::core::ffi::c_char,
1475 pub as_send_port: _Dart_CObject__bindgen_ty_1__bindgen_ty_1,
1476 pub as_capability: _Dart_CObject__bindgen_ty_1__bindgen_ty_2,
1477 pub as_array: _Dart_CObject__bindgen_ty_1__bindgen_ty_3,
1478 pub as_typed_data: _Dart_CObject__bindgen_ty_1__bindgen_ty_4,
1479 pub as_external_typed_data: _Dart_CObject__bindgen_ty_1__bindgen_ty_5,
1480 pub as_native_pointer: _Dart_CObject__bindgen_ty_1__bindgen_ty_6,
1481}
1482extern "C" {
1483 pub fn __va_start(arg1: *mut *mut ::core::ffi::c_char, ...);
1484}
1485extern "C" {
1486 pub fn __security_init_cookie();
1487}
1488extern "C" {
1489 pub fn __security_check_cookie(_StackCookie: usize);
1490}
1491extern "C" {
1492 pub fn __report_gsfailure(_StackCookie: usize) -> !;
1493}
1494extern "C" {
1495 pub static mut __security_cookie: usize;
1496}
1497extern "C" {
1498 pub fn _invalid_parameter_noinfo();
1499}
1500extern "C" {
1501 pub fn _invalid_parameter_noinfo_noreturn() -> !;
1502}
1503extern "C" {
1504 pub fn _invoke_watson(
1505 _Expression: *const wchar_t, _FunctionName: *const wchar_t, _FileName: *const wchar_t,
1506 _LineNo: ::core::ffi::c_uint, _Reserved: usize,
1507 ) -> !;
1508}
1509extern "C" {
1510 pub fn _wassert(_Message: *const wchar_t, _File: *const wchar_t, _Line: ::core::ffi::c_uint);
1511}
1512extern "C" {
1513 pub fn imaxabs(_Number: intmax_t) -> intmax_t;
1514}
1515extern "C" {
1516 pub fn imaxdiv(_Numerator: intmax_t, _Denominator: intmax_t) -> imaxdiv_t;
1517}
1518extern "C" {
1519 pub fn strtoimax(
1520 _String: *const ::core::ffi::c_char, _EndPtr: *mut *mut ::core::ffi::c_char, _Radix: ::core::ffi::c_int,
1521 ) -> intmax_t;
1522}
1523extern "C" {
1524 pub fn _strtoimax_l(
1525 _String: *const ::core::ffi::c_char, _EndPtr: *mut *mut ::core::ffi::c_char, _Radix: ::core::ffi::c_int,
1526 _Locale: _locale_t,
1527 ) -> intmax_t;
1528}
1529extern "C" {
1530 pub fn strtoumax(
1531 _String: *const ::core::ffi::c_char, _EndPtr: *mut *mut ::core::ffi::c_char, _Radix: ::core::ffi::c_int,
1532 ) -> uintmax_t;
1533}
1534extern "C" {
1535 pub fn _strtoumax_l(
1536 _String: *const ::core::ffi::c_char, _EndPtr: *mut *mut ::core::ffi::c_char, _Radix: ::core::ffi::c_int,
1537 _Locale: _locale_t,
1538 ) -> uintmax_t;
1539}
1540extern "C" {
1541 pub fn wcstoimax(_String: *const wchar_t, _EndPtr: *mut *mut wchar_t, _Radix: ::core::ffi::c_int) -> intmax_t;
1542}
1543extern "C" {
1544 pub fn _wcstoimax_l(
1545 _String: *const wchar_t, _EndPtr: *mut *mut wchar_t, _Radix: ::core::ffi::c_int, _Locale: _locale_t,
1546 ) -> intmax_t;
1547}
1548extern "C" {
1549 pub fn wcstoumax(_String: *const wchar_t, _EndPtr: *mut *mut wchar_t, _Radix: ::core::ffi::c_int) -> uintmax_t;
1550}
1551extern "C" {
1552 pub fn _wcstoumax_l(
1553 _String: *const wchar_t, _EndPtr: *mut *mut wchar_t, _Radix: ::core::ffi::c_int, _Locale: _locale_t,
1554 ) -> uintmax_t;
1555}
1556extern "C" {
1557 /// Is this an error handle?
1558 ///
1559 /// Requires there to be a current isolate.
1560 pub fn Dart_IsError(handle: Dart_Handle) -> bool;
1561}
1562extern "C" {
1563 /// Is this an api error handle?
1564 ///
1565 /// Api error handles are produced when an api function is misused.
1566 /// This happens when a Dart embedding api function is called with
1567 /// invalid arguments or in an invalid context.
1568 ///
1569 /// Requires there to be a current isolate.
1570 pub fn Dart_IsApiError(handle: Dart_Handle) -> bool;
1571}
1572extern "C" {
1573 /// Is this an unhandled exception error handle?
1574 ///
1575 /// Unhandled exception error handles are produced when, during the
1576 /// execution of Dart code, an exception is thrown but not caught.
1577 /// This can occur in any function which triggers the execution of Dart
1578 /// code.
1579 ///
1580 /// See Dart_ErrorGetException and Dart_ErrorGetStackTrace.
1581 ///
1582 /// Requires there to be a current isolate.
1583 pub fn Dart_IsUnhandledExceptionError(handle: Dart_Handle) -> bool;
1584}
1585extern "C" {
1586 /// Is this a compilation error handle?
1587 ///
1588 /// Compilation error handles are produced when, during the execution
1589 /// of Dart code, a compile-time error occurs. This can occur in any
1590 /// function which triggers the execution of Dart code.
1591 ///
1592 /// Requires there to be a current isolate.
1593 pub fn Dart_IsCompilationError(handle: Dart_Handle) -> bool;
1594}
1595extern "C" {
1596 /// Is this a fatal error handle?
1597 ///
1598 /// Fatal error handles are produced when the system wants to shut down
1599 /// the current isolate.
1600 ///
1601 /// Requires there to be a current isolate.
1602 pub fn Dart_IsFatalError(handle: Dart_Handle) -> bool;
1603}
1604extern "C" {
1605 /// Gets the error message from an error handle.
1606 ///
1607 /// Requires there to be a current isolate.
1608 ///
1609 /// \return A C string containing an error message if the handle is
1610 /// error. An empty C string ("") if the handle is valid. This C
1611 /// String is scope allocated and is only valid until the next call
1612 /// to Dart_ExitScope.
1613 pub fn Dart_GetError(handle: Dart_Handle) -> *const ::core::ffi::c_char;
1614}
1615extern "C" {
1616 /// Is this an error handle for an unhandled exception?
1617 pub fn Dart_ErrorHasException(handle: Dart_Handle) -> bool;
1618}
1619extern "C" {
1620 /// Gets the exception Object from an unhandled exception error handle.
1621 pub fn Dart_ErrorGetException(handle: Dart_Handle) -> Dart_Handle;
1622}
1623extern "C" {
1624 /// Gets the stack trace Object from an unhandled exception error handle.
1625 pub fn Dart_ErrorGetStackTrace(handle: Dart_Handle) -> Dart_Handle;
1626}
1627extern "C" {
1628 /// Produces an api error handle with the provided error message.
1629 ///
1630 /// Requires there to be a current isolate.
1631 ///
1632 /// \param error the error message.
1633 pub fn Dart_NewApiError(error: *const ::core::ffi::c_char) -> Dart_Handle;
1634}
1635extern "C" {
1636 pub fn Dart_NewCompilationError(error: *const ::core::ffi::c_char) -> Dart_Handle;
1637}
1638extern "C" {
1639 /// Produces a new unhandled exception error handle.
1640 ///
1641 /// Requires there to be a current isolate.
1642 ///
1643 /// \param exception An instance of a Dart object to be thrown or
1644 /// an ApiError or CompilationError handle.
1645 /// When an ApiError or CompilationError handle is passed in
1646 /// a string object of the error message is created and it becomes
1647 /// the Dart object to be thrown.
1648 pub fn Dart_NewUnhandledExceptionError(exception: Dart_Handle) -> Dart_Handle;
1649}
1650extern "C" {
1651 /// Propagates an error.
1652 ///
1653 /// If the provided handle is an unhandled exception error, this
1654 /// function will cause the unhandled exception to be rethrown. This
1655 /// will proceed in the standard way, walking up Dart frames until an
1656 /// appropriate 'catch' block is found, executing 'finally' blocks,
1657 /// etc.
1658 ///
1659 /// If the error is not an unhandled exception error, we will unwind
1660 /// the stack to the next C frame. Intervening Dart frames will be
1661 /// discarded; specifically, 'finally' blocks will not execute. This
1662 /// is the standard way that compilation errors (and the like) are
1663 /// handled by the Dart runtime.
1664 ///
1665 /// In either case, when an error is propagated any current scopes
1666 /// created by Dart_EnterScope will be exited.
1667 ///
1668 /// See the additional discussion under "Propagating Errors" at the
1669 /// beginning of this file.
1670 ///
1671 /// \param handle An error handle (See Dart_IsError)
1672 ///
1673 /// On success, this function does not return. On failure, the
1674 /// process is terminated.
1675 pub fn Dart_PropagateError(handle: Dart_Handle);
1676}
1677extern "C" {
1678 /// Converts an object to a string.
1679 ///
1680 /// May generate an unhandled exception error.
1681 ///
1682 /// \return The converted string if no error occurs during
1683 /// the conversion. If an error does occur, an error handle is
1684 /// returned.
1685 pub fn Dart_ToString(object: Dart_Handle) -> Dart_Handle;
1686}
1687extern "C" {
1688 /// Checks to see if two handles refer to identically equal objects.
1689 ///
1690 /// If both handles refer to instances, this is equivalent to using the top-level
1691 /// function identical() from dart:core. Otherwise, returns whether the two
1692 /// argument handles refer to the same object.
1693 ///
1694 /// \param obj1 An object to be compared.
1695 /// \param obj2 An object to be compared.
1696 ///
1697 /// \return True if the objects are identically equal. False otherwise.
1698 pub fn Dart_IdentityEquals(obj1: Dart_Handle, obj2: Dart_Handle) -> bool;
1699}
1700extern "C" {
1701 /// Allocates a handle in the current scope from a persistent handle.
1702 pub fn Dart_HandleFromPersistent(object: Dart_PersistentHandle) -> Dart_Handle;
1703}
1704extern "C" {
1705 /// Allocates a handle in the current scope from a weak persistent handle.
1706 ///
1707 /// This will be a handle to Dart_Null if the object has been garbage collected.
1708 pub fn Dart_HandleFromWeakPersistent(object: Dart_WeakPersistentHandle) -> Dart_Handle;
1709}
1710extern "C" {
1711 /// Allocates a persistent handle for an object.
1712 ///
1713 /// This handle has the lifetime of the current isolate unless it is
1714 /// explicitly deallocated by calling Dart_DeletePersistentHandle.
1715 ///
1716 /// Requires there to be a current isolate.
1717 pub fn Dart_NewPersistentHandle(object: Dart_Handle) -> Dart_PersistentHandle;
1718}
1719extern "C" {
1720 /// Assign value of local handle to a persistent handle.
1721 ///
1722 /// Requires there to be a current isolate.
1723 ///
1724 /// \param obj1 A persistent handle whose value needs to be set.
1725 /// \param obj2 An object whose value needs to be set to the persistent handle.
1726 pub fn Dart_SetPersistentHandle(obj1: Dart_PersistentHandle, obj2: Dart_Handle);
1727}
1728extern "C" {
1729 /// Deallocates a persistent handle.
1730 ///
1731 /// Requires there to be a current isolate group.
1732 pub fn Dart_DeletePersistentHandle(object: Dart_PersistentHandle);
1733}
1734extern "C" {
1735 /// Allocates a weak persistent handle for an object.
1736 ///
1737 /// This handle has the lifetime of the current isolate. The handle can also be
1738 /// explicitly deallocated by calling Dart_DeleteWeakPersistentHandle.
1739 ///
1740 /// If the object becomes unreachable the callback is invoked with the peer as
1741 /// argument. The callback can be executed on any thread, will have a current
1742 /// isolate group, but will not have a current isolate. The callback can only
1743 /// call Dart_DeletePersistentHandle or Dart_DeleteWeakPersistentHandle. This
1744 /// gives the embedder the ability to cleanup data associated with the object.
1745 /// The handle will point to the Dart_Null object after the finalizer has been
1746 /// run. It is illegal to call into the VM with any other Dart_* functions from
1747 /// the callback. If the handle is deleted before the object becomes
1748 /// unreachable, the callback is never invoked.
1749 ///
1750 /// Requires there to be a current isolate.
1751 ///
1752 /// \param object An object with identity.
1753 /// \param peer A pointer to a native object or NULL. This value is
1754 /// provided to callback when it is invoked.
1755 /// \param external_allocation_size The number of externally allocated
1756 /// bytes for peer. Used to inform the garbage collector.
1757 /// \param callback A function pointer that will be invoked sometime
1758 /// after the object is garbage collected, unless the handle has been deleted.
1759 /// A valid callback needs to be specified it cannot be NULL.
1760 ///
1761 /// \return The weak persistent handle or NULL. NULL is returned in case of bad
1762 /// parameters.
1763 pub fn Dart_NewWeakPersistentHandle(
1764 object: Dart_Handle, peer: *mut ::core::ffi::c_void, external_allocation_size: isize,
1765 callback: Dart_HandleFinalizer,
1766 ) -> Dart_WeakPersistentHandle;
1767}
1768extern "C" {
1769 /// Deletes the given weak persistent [object] handle.
1770 ///
1771 /// Requires there to be a current isolate group.
1772 pub fn Dart_DeleteWeakPersistentHandle(object: Dart_WeakPersistentHandle);
1773}
1774extern "C" {
1775 /// Allocates a finalizable handle for an object.
1776 ///
1777 /// This handle has the lifetime of the current isolate group unless the object
1778 /// pointed to by the handle is garbage collected, in this case the VM
1779 /// automatically deletes the handle after invoking the callback associated
1780 /// with the handle. The handle can also be explicitly deallocated by
1781 /// calling Dart_DeleteFinalizableHandle.
1782 ///
1783 /// If the object becomes unreachable the callback is invoked with the
1784 /// the peer as argument. The callback can be executed on any thread, will have
1785 /// an isolate group, but will not have a current isolate. The callback can only
1786 /// call Dart_DeletePersistentHandle or Dart_DeleteWeakPersistentHandle.
1787 /// This gives the embedder the ability to cleanup data associated with the
1788 /// object and clear out any cached references to the handle. All references to
1789 /// this handle after the callback will be invalid. It is illegal to call into
1790 /// the VM with any other Dart_* functions from the callback. If the handle is
1791 /// deleted before the object becomes unreachable, the callback is never
1792 /// invoked.
1793 ///
1794 /// Requires there to be a current isolate.
1795 ///
1796 /// \param object An object with identity.
1797 /// \param peer A pointer to a native object or NULL. This value is
1798 /// provided to callback when it is invoked.
1799 /// \param external_allocation_size The number of externally allocated
1800 /// bytes for peer. Used to inform the garbage collector.
1801 /// \param callback A function pointer that will be invoked sometime
1802 /// after the object is garbage collected, unless the handle has been deleted.
1803 /// A valid callback needs to be specified it cannot be NULL.
1804 ///
1805 /// \return The finalizable handle or NULL. NULL is returned in case of bad
1806 /// parameters.
1807 pub fn Dart_NewFinalizableHandle(
1808 object: Dart_Handle, peer: *mut ::core::ffi::c_void, external_allocation_size: isize,
1809 callback: Dart_HandleFinalizer,
1810 ) -> Dart_FinalizableHandle;
1811}
1812extern "C" {
1813 /// Deletes the given finalizable [object] handle.
1814 ///
1815 /// The caller has to provide the actual Dart object the handle was created from
1816 /// to prove the object (and therefore the finalizable handle) is still alive.
1817 ///
1818 /// Requires there to be a current isolate.
1819 pub fn Dart_DeleteFinalizableHandle(object: Dart_FinalizableHandle, strong_ref_to_object: Dart_Handle);
1820}
1821extern "C" {
1822 /// Gets the version string for the Dart VM.
1823 ///
1824 /// The version of the Dart VM can be accessed without initializing the VM.
1825 ///
1826 /// \return The version string for the embedded Dart VM.
1827 pub fn Dart_VersionString() -> *const ::core::ffi::c_char;
1828}
1829extern "C" {
1830 /// Initialize Dart_IsolateFlags with correct version and default values.
1831 pub fn Dart_IsolateFlagsInitialize(flags: *mut Dart_IsolateFlags);
1832}
1833extern "C" {
1834 /// Initializes the VM.
1835 ///
1836 /// \param params A struct containing initialization information. The version
1837 /// field of the struct must be DART_INITIALIZE_PARAMS_CURRENT_VERSION.
1838 ///
1839 /// \return NULL if initialization is successful. Returns an error message
1840 /// otherwise. The caller is responsible for freeing the error message.
1841 pub fn Dart_Initialize(params: *mut Dart_InitializeParams) -> *mut ::core::ffi::c_char;
1842}
1843extern "C" {
1844 /// Cleanup state in the VM before process termination.
1845 ///
1846 /// \return NULL if cleanup is successful. Returns an error message otherwise.
1847 /// The caller is responsible for freeing the error message.
1848 ///
1849 /// NOTE: This function must not be called on a thread that was created by the VM
1850 /// itself.
1851 pub fn Dart_Cleanup() -> *mut ::core::ffi::c_char;
1852}
1853extern "C" {
1854 /// Sets command line flags. Should be called before Dart_Initialize.
1855 ///
1856 /// \param argc The length of the arguments array.
1857 /// \param argv An array of arguments.
1858 ///
1859 /// \return NULL if successful. Returns an error message otherwise.
1860 /// The caller is responsible for freeing the error message.
1861 ///
1862 /// NOTE: This call does not store references to the passed in c-strings.
1863 pub fn Dart_SetVMFlags(argc: ::core::ffi::c_int, argv: *mut *const ::core::ffi::c_char)
1864 -> *mut ::core::ffi::c_char;
1865}
1866extern "C" {
1867 /// Returns true if the named VM flag is of boolean type, specified, and set to
1868 /// true.
1869 ///
1870 /// \param flag_name The name of the flag without leading punctuation
1871 /// (example: "enable_asserts").
1872 pub fn Dart_IsVMFlagSet(flag_name: *const ::core::ffi::c_char) -> bool;
1873}
1874extern "C" {
1875 /// Creates a new isolate. The new isolate becomes the current isolate.
1876 ///
1877 /// A snapshot can be used to restore the VM quickly to a saved state
1878 /// and is useful for fast startup. If snapshot data is provided, the
1879 /// isolate will be started using that snapshot data. Requires a core snapshot or
1880 /// an app snapshot created by Dart_CreateSnapshot or
1881 /// Dart_CreatePrecompiledSnapshot* from a VM with the same version.
1882 ///
1883 /// Requires there to be no current isolate.
1884 ///
1885 /// \param script_uri The main source file or snapshot this isolate will load.
1886 /// The VM will provide this URI to the Dart_IsolateGroupCreateCallback when a
1887 /// child isolate is created by Isolate.spawn. The embedder should use a URI
1888 /// that allows it to load the same program into such a child isolate.
1889 /// \param name A short name for the isolate to improve debugging messages.
1890 /// Typically of the format 'foo.dart:main()'.
1891 /// \param isolate_snapshot_data Buffer containing the snapshot data of the
1892 /// isolate or NULL if no snapshot is provided. If provided, the buffer must
1893 /// remain valid until the isolate shuts down.
1894 /// \param isolate_snapshot_instructions Buffer containing the snapshot
1895 /// instructions of the isolate or NULL if no snapshot is provided. If
1896 /// provided, the buffer must remain valid until the isolate shuts down.
1897 /// \param flags Pointer to VM specific flags or NULL for default flags.
1898 /// \param isolate_group_data Embedder group data. This data can be obtained
1899 /// by calling Dart_IsolateGroupData and will be passed to the
1900 /// Dart_IsolateShutdownCallback, Dart_IsolateCleanupCallback, and
1901 /// Dart_IsolateGroupCleanupCallback.
1902 /// \param isolate_data Embedder data. This data will be passed to
1903 /// the Dart_IsolateGroupCreateCallback when new isolates are spawned from
1904 /// this parent isolate.
1905 /// \param error Returns NULL if creation is successful, an error message
1906 /// otherwise. The caller is responsible for calling free() on the error
1907 /// message.
1908 ///
1909 /// \return The new isolate on success, or NULL if isolate creation failed.
1910 pub fn Dart_CreateIsolateGroup(
1911 script_uri: *const ::core::ffi::c_char, name: *const ::core::ffi::c_char, isolate_snapshot_data: *const u8,
1912 isolate_snapshot_instructions: *const u8, flags: *mut Dart_IsolateFlags,
1913 isolate_group_data: *mut ::core::ffi::c_void, isolate_data: *mut ::core::ffi::c_void,
1914 error: *mut *mut ::core::ffi::c_char,
1915 ) -> Dart_Isolate;
1916}
1917extern "C" {
1918 /// Creates a new isolate inside the isolate group of [group_member].
1919 ///
1920 /// Requires there to be no current isolate.
1921 ///
1922 /// \param group_member An isolate from the same group into which the newly created
1923 /// isolate should be born into. Other threads may not have entered / enter this
1924 /// member isolate.
1925 /// \param name A short name for the isolate for debugging purposes.
1926 /// \param shutdown_callback A callback to be called when the isolate is being
1927 /// shutdown (may be NULL).
1928 /// \param cleanup_callback A callback to be called when the isolate is being
1929 /// cleaned up (may be NULL).
1930 /// \param child_isolate_data The embedder-specific data associated with this isolate.
1931 /// \param error Set to NULL if creation is successful, set to an error
1932 /// message otherwise. The caller is responsible for calling free() on the
1933 /// error message.
1934 ///
1935 /// \return The newly created isolate on success, or NULL if isolate creation
1936 /// failed.
1937 ///
1938 /// If successful, the newly created isolate will become the current isolate.
1939 pub fn Dart_CreateIsolateInGroup(
1940 group_member: Dart_Isolate, name: *const ::core::ffi::c_char, shutdown_callback: Dart_IsolateShutdownCallback,
1941 cleanup_callback: Dart_IsolateCleanupCallback, child_isolate_data: *mut ::core::ffi::c_void,
1942 error: *mut *mut ::core::ffi::c_char,
1943 ) -> Dart_Isolate;
1944}
1945extern "C" {
1946 /// Creates a new isolate from a Dart Kernel file. The new isolate
1947 /// becomes the current isolate.
1948 ///
1949 /// Requires there to be no current isolate.
1950 ///
1951 /// \param script_uri The main source file or snapshot this isolate will load.
1952 /// The VM will provide this URI to the Dart_IsolateGroupCreateCallback when a
1953 /// child isolate is created by Isolate.spawn. The embedder should use a URI that
1954 /// allows it to load the same program into such a child isolate.
1955 /// \param name A short name for the isolate to improve debugging messages.
1956 /// Typically of the format 'foo.dart:main()'.
1957 /// \param kernel_buffer A buffer which contains a kernel/DIL program. Must
1958 /// remain valid until isolate shutdown.
1959 /// \param kernel_buffer_size The size of `kernel_buffer`.
1960 /// \param flags Pointer to VM specific flags or NULL for default flags.
1961 /// \param isolate_group_data Embedder group data. This data can be obtained
1962 /// by calling Dart_IsolateGroupData and will be passed to the
1963 /// Dart_IsolateShutdownCallback, Dart_IsolateCleanupCallback, and
1964 /// Dart_IsolateGroupCleanupCallback.
1965 /// \param isolate_data Embedder data. This data will be passed to
1966 /// the Dart_IsolateGroupCreateCallback when new isolates are spawned from
1967 /// this parent isolate.
1968 /// \param error Returns NULL if creation is successful, an error message
1969 /// otherwise. The caller is responsible for calling free() on the error
1970 /// message.
1971 ///
1972 /// \return The new isolate on success, or NULL if isolate creation failed.
1973 pub fn Dart_CreateIsolateGroupFromKernel(
1974 script_uri: *const ::core::ffi::c_char, name: *const ::core::ffi::c_char, kernel_buffer: *const u8,
1975 kernel_buffer_size: isize, flags: *mut Dart_IsolateFlags, isolate_group_data: *mut ::core::ffi::c_void,
1976 isolate_data: *mut ::core::ffi::c_void, error: *mut *mut ::core::ffi::c_char,
1977 ) -> Dart_Isolate;
1978}
1979extern "C" {
1980 /// Shuts down the current isolate. After this call, the current isolate is NULL.
1981 /// Any current scopes created by Dart_EnterScope will be exited. Invokes the
1982 /// shutdown callback and any callbacks of remaining weak persistent handles.
1983 ///
1984 /// Requires there to be a current isolate.
1985 pub fn Dart_ShutdownIsolate();
1986}
1987extern "C" {
1988 /// Returns the current isolate. Will return NULL if there is no
1989 /// current isolate.
1990 pub fn Dart_CurrentIsolate() -> Dart_Isolate;
1991}
1992extern "C" {
1993 /// Returns the callback data associated with the current isolate. This
1994 /// data was set when the isolate got created or initialized.
1995 pub fn Dart_CurrentIsolateData() -> *mut ::core::ffi::c_void;
1996}
1997extern "C" {
1998 /// Returns the callback data associated with the given isolate. This
1999 /// data was set when the isolate got created or initialized.
2000 pub fn Dart_IsolateData(isolate: Dart_Isolate) -> *mut ::core::ffi::c_void;
2001}
2002extern "C" {
2003 /// Returns the current isolate group. Will return NULL if there is no
2004 /// current isolate group.
2005 pub fn Dart_CurrentIsolateGroup() -> Dart_IsolateGroup;
2006}
2007extern "C" {
2008 /// Returns the callback data associated with the current isolate group. This
2009 /// data was passed to the isolate group when it was created.
2010 pub fn Dart_CurrentIsolateGroupData() -> *mut ::core::ffi::c_void;
2011}
2012extern "C" {
2013 pub fn Dart_CurrentIsolateGroupId() -> Dart_IsolateGroupId;
2014}
2015extern "C" {
2016 /// Returns the callback data associated with the specified isolate group. This
2017 /// data was passed to the isolate when it was created.
2018 /// The embedder is responsible for ensuring the consistency of this data
2019 /// with respect to the lifecycle of an isolate group.
2020 pub fn Dart_IsolateGroupData(isolate: Dart_Isolate) -> *mut ::core::ffi::c_void;
2021}
2022extern "C" {
2023 /// Returns the debugging name for the current isolate.
2024 ///
2025 /// This name is unique to each isolate and should only be used to make
2026 /// debugging messages more comprehensible.
2027 pub fn Dart_DebugName() -> Dart_Handle;
2028}
2029extern "C" {
2030 /// Returns the debugging name for the current isolate.
2031 ///
2032 /// This name is unique to each isolate and should only be used to make
2033 /// debugging messages more comprehensible.
2034 ///
2035 /// The returned string is scope allocated and is only valid until the next call
2036 /// to Dart_ExitScope.
2037 pub fn Dart_DebugNameToCString() -> *const ::core::ffi::c_char;
2038}
2039extern "C" {
2040 /// Returns the ID for an isolate which is used to query the service protocol.
2041 ///
2042 /// It is the responsibility of the caller to free the returned ID.
2043 pub fn Dart_IsolateServiceId(isolate: Dart_Isolate) -> *const ::core::ffi::c_char;
2044}
2045extern "C" {
2046 /// Enters an isolate. After calling this function,
2047 /// the current isolate will be set to the provided isolate.
2048 ///
2049 /// Requires there to be no current isolate. Multiple threads may not be in
2050 /// the same isolate at once.
2051 pub fn Dart_EnterIsolate(isolate: Dart_Isolate);
2052}
2053extern "C" {
2054 /// Kills the given isolate.
2055 ///
2056 /// This function has the same effect as dart:isolate's
2057 /// Isolate.kill(priority:immediate).
2058 /// It can interrupt ordinary Dart code but not native code. If the isolate is
2059 /// in the middle of a long running native function, the isolate will not be
2060 /// killed until control returns to Dart.
2061 ///
2062 /// Does not require a current isolate. It is safe to kill the current isolate if
2063 /// there is one.
2064 pub fn Dart_KillIsolate(isolate: Dart_Isolate);
2065}
2066extern "C" {
2067 /// Notifies the VM that the embedder expects to be idle until |deadline|. The VM
2068 /// may use this time to perform garbage collection or other tasks to avoid
2069 /// delays during execution of Dart code in the future.
2070 ///
2071 /// |deadline| is measured in microseconds against the system's monotonic time.
2072 /// This clock can be accessed via Dart_TimelineGetMicros().
2073 ///
2074 /// Requires there to be a current isolate.
2075 pub fn Dart_NotifyIdle(deadline: i64);
2076}
2077extern "C" {
2078 /// Starts the heap sampling profiler for each thread in the VM.
2079 pub fn Dart_EnableHeapSampling();
2080}
2081extern "C" {
2082 pub fn Dart_DisableHeapSampling();
2083}
2084extern "C" {
2085 pub fn Dart_RegisterHeapSamplingCallback(
2086 create_callback: Dart_HeapSamplingCreateCallback, delete_callback: Dart_HeapSamplingDeleteCallback,
2087 );
2088}
2089extern "C" {
2090 pub fn Dart_ReportSurvivingAllocations(
2091 callback: Dart_HeapSamplingReportCallback, context: *mut ::core::ffi::c_void, force_gc: bool,
2092 );
2093}
2094extern "C" {
2095 pub fn Dart_SetHeapSamplingPeriod(bytes: isize);
2096}
2097extern "C" {
2098 /// Notifies the VM that the embedder expects the application's working set has
2099 /// recently shrunk significantly and is not expected to rise in the near future.
2100 /// The VM may spend O(heap-size) time performing clean up work.
2101 ///
2102 /// Requires there to be a current isolate.
2103 pub fn Dart_NotifyDestroyed();
2104}
2105extern "C" {
2106 /// Notifies the VM that the system is running low on memory.
2107 ///
2108 /// Does not require a current isolate. Only valid after calling Dart_Initialize.
2109 pub fn Dart_NotifyLowMemory();
2110}
2111extern "C" {
2112 /// Set the desired performance trade-off.
2113 ///
2114 /// Requires a current isolate.
2115 ///
2116 /// Returns the previous performance mode.
2117 pub fn Dart_SetPerformanceMode(mode: Dart_PerformanceMode) -> Dart_PerformanceMode;
2118}
2119extern "C" {
2120 /// Starts the CPU sampling profiler.
2121 pub fn Dart_StartProfiling();
2122}
2123extern "C" {
2124 /// Stops the CPU sampling profiler.
2125 ///
2126 /// Note that some profile samples might still be taken after this function
2127 /// returns due to the asynchronous nature of the implementation on some
2128 /// platforms.
2129 pub fn Dart_StopProfiling();
2130}
2131extern "C" {
2132 /// Notifies the VM that the current thread should not be profiled until a
2133 /// matching call to Dart_ThreadEnableProfiling is made.
2134 ///
2135 /// NOTE: By default, if a thread has entered an isolate it will be profiled.
2136 /// This function should be used when an embedder knows a thread is about
2137 /// to make a blocking call and wants to avoid unnecessary interrupts by
2138 /// the profiler.
2139 pub fn Dart_ThreadDisableProfiling();
2140}
2141extern "C" {
2142 /// Notifies the VM that the current thread should be profiled.
2143 ///
2144 /// NOTE: It is only legal to call this function *after* calling
2145 /// Dart_ThreadDisableProfiling.
2146 ///
2147 /// NOTE: By default, if a thread has entered an isolate it will be profiled.
2148 pub fn Dart_ThreadEnableProfiling();
2149}
2150extern "C" {
2151 /// Register symbol information for the Dart VM's profiler and crash dumps.
2152 ///
2153 /// This consumes the output of //topaz/runtime/dart/profiler_symbols, which
2154 /// should be treated as opaque.
2155 pub fn Dart_AddSymbols(dso_name: *const ::core::ffi::c_char, buffer: *mut ::core::ffi::c_void, buffer_size: isize);
2156}
2157extern "C" {
2158 /// Exits an isolate. After this call, Dart_CurrentIsolate will
2159 /// return NULL.
2160 ///
2161 /// Requires there to be a current isolate.
2162 pub fn Dart_ExitIsolate();
2163}
2164extern "C" {
2165 /// Creates a full snapshot of the current isolate heap.
2166 ///
2167 /// A full snapshot is a compact representation of the dart vm isolate heap
2168 /// and dart isolate heap states. These snapshots are used to initialize
2169 /// the vm isolate on startup and fast initialization of an isolate.
2170 /// A Snapshot of the heap is created before any dart code has executed.
2171 ///
2172 /// Requires there to be a current isolate. Not available in the precompiled
2173 /// runtime (check Dart_IsPrecompiledRuntime).
2174 ///
2175 /// \param vm_snapshot_data_buffer Returns a pointer to a buffer containing the
2176 /// vm snapshot. This buffer is scope allocated and is only valid
2177 /// until the next call to Dart_ExitScope.
2178 /// \param vm_snapshot_data_size Returns the size of vm_snapshot_data_buffer.
2179 /// \param isolate_snapshot_data_buffer Returns a pointer to a buffer containing
2180 /// the isolate snapshot. This buffer is scope allocated and is only valid
2181 /// until the next call to Dart_ExitScope.
2182 /// \param isolate_snapshot_data_size Returns the size of
2183 /// isolate_snapshot_data_buffer.
2184 /// \param is_core Create a snapshot containing core libraries.
2185 /// Such snapshot should be agnostic to null safety mode.
2186 ///
2187 /// \return A valid handle if no error occurs during the operation.
2188 pub fn Dart_CreateSnapshot(
2189 vm_snapshot_data_buffer: *mut *mut u8, vm_snapshot_data_size: *mut isize,
2190 isolate_snapshot_data_buffer: *mut *mut u8, isolate_snapshot_data_size: *mut isize, is_core: bool,
2191 ) -> Dart_Handle;
2192}
2193extern "C" {
2194 /// Returns whether the buffer contains a kernel file.
2195 ///
2196 /// \param buffer Pointer to a buffer that might contain a kernel binary.
2197 /// \param buffer_size Size of the buffer.
2198 ///
2199 /// \return Whether the buffer contains a kernel binary (full or partial).
2200 pub fn Dart_IsKernel(buffer: *const u8, buffer_size: isize) -> bool;
2201}
2202extern "C" {
2203 /// Make isolate runnable.
2204 ///
2205 /// When isolates are spawned, this function is used to indicate that
2206 /// the creation and initialization (including script loading) of the
2207 /// isolate is complete and the isolate can start.
2208 /// This function expects there to be no current isolate.
2209 ///
2210 /// \param isolate The isolate to be made runnable.
2211 ///
2212 /// \return NULL if successful. Returns an error message otherwise. The caller
2213 /// is responsible for freeing the error message.
2214 pub fn Dart_IsolateMakeRunnable(isolate: Dart_Isolate) -> *mut ::core::ffi::c_char;
2215}
2216extern "C" {
2217 /// Allows embedders to provide a custom wakeup mechanism for the delivery of
2218 /// inter-isolate messages. This setting only applies to the current isolate.
2219 ///
2220 /// This mechanism is optional: if not provided, the isolate will be scheduled on
2221 /// a VM-managed thread pool. An embedder should provide this callback if it
2222 /// wants to run an isolate on a specific thread or to interleave handling of
2223 /// inter-isolate messages with other event sources.
2224 ///
2225 /// Most embedders will only call this function once, before isolate
2226 /// execution begins. If this function is called after isolate
2227 /// execution begins, the embedder is responsible for threading issues.
2228 pub fn Dart_SetMessageNotifyCallback(message_notify_callback: Dart_MessageNotifyCallback);
2229}
2230extern "C" {
2231 /// Query the current message notify callback for the isolate.
2232 ///
2233 /// \return The current message notify callback for the isolate.
2234 pub fn Dart_GetMessageNotifyCallback() -> Dart_MessageNotifyCallback;
2235}
2236extern "C" {
2237 /// If the VM flag `--pause-isolates-on-start` was passed this will be true.
2238 ///
2239 /// \return A boolean value indicating if pause on start was requested.
2240 pub fn Dart_ShouldPauseOnStart() -> bool;
2241}
2242extern "C" {
2243 /// Override the VM flag `--pause-isolates-on-start` for the current isolate.
2244 ///
2245 /// \param should_pause Should the isolate be paused on start?
2246 ///
2247 /// NOTE: This must be called before Dart_IsolateMakeRunnable.
2248 pub fn Dart_SetShouldPauseOnStart(should_pause: bool);
2249}
2250extern "C" {
2251 /// Is the current isolate paused on start?
2252 ///
2253 /// \return A boolean value indicating if the isolate is paused on start.
2254 pub fn Dart_IsPausedOnStart() -> bool;
2255}
2256extern "C" {
2257 /// Called when the embedder has paused the current isolate on start and when
2258 /// the embedder has resumed the isolate.
2259 ///
2260 /// \param paused Is the isolate paused on start?
2261 pub fn Dart_SetPausedOnStart(paused: bool);
2262}
2263extern "C" {
2264 /// If the VM flag `--pause-isolates-on-exit` was passed this will be true.
2265 ///
2266 /// \return A boolean value indicating if pause on exit was requested.
2267 pub fn Dart_ShouldPauseOnExit() -> bool;
2268}
2269extern "C" {
2270 /// Override the VM flag `--pause-isolates-on-exit` for the current isolate.
2271 ///
2272 /// \param should_pause Should the isolate be paused on exit?
2273 pub fn Dart_SetShouldPauseOnExit(should_pause: bool);
2274}
2275extern "C" {
2276 /// Is the current isolate paused on exit?
2277 ///
2278 /// \return A boolean value indicating if the isolate is paused on exit.
2279 pub fn Dart_IsPausedOnExit() -> bool;
2280}
2281extern "C" {
2282 /// Called when the embedder has paused the current isolate on exit and when
2283 /// the embedder has resumed the isolate.
2284 ///
2285 /// \param paused Is the isolate paused on exit?
2286 pub fn Dart_SetPausedOnExit(paused: bool);
2287}
2288extern "C" {
2289 /// Called when the embedder has caught a top level unhandled exception error
2290 /// in the current isolate.
2291 ///
2292 /// NOTE: It is illegal to call this twice on the same isolate without first
2293 /// clearing the sticky error to null.
2294 ///
2295 /// \param error The unhandled exception error.
2296 pub fn Dart_SetStickyError(error: Dart_Handle);
2297}
2298extern "C" {
2299 /// Does the current isolate have a sticky error?
2300 pub fn Dart_HasStickyError() -> bool;
2301}
2302extern "C" {
2303 /// Gets the sticky error for the current isolate.
2304 ///
2305 /// \return A handle to the sticky error object or null.
2306 pub fn Dart_GetStickyError() -> Dart_Handle;
2307}
2308extern "C" {
2309 /// Handles the next pending message for the current isolate.
2310 ///
2311 /// May generate an unhandled exception error.
2312 ///
2313 /// \return A valid handle if no error occurs during the operation.
2314 pub fn Dart_HandleMessage() -> Dart_Handle;
2315}
2316extern "C" {
2317 /// Drains the microtask queue, then blocks the calling thread until the current
2318 /// isolate receives a message, then handles all messages.
2319 ///
2320 /// \param timeout_millis When non-zero, the call returns after the indicated
2321 /// number of milliseconds even if no message was received.
2322 /// \return A valid handle if no error occurs, otherwise an error handle.
2323 pub fn Dart_WaitForEvent(timeout_millis: i64) -> Dart_Handle;
2324}
2325extern "C" {
2326 /// Handles any pending messages for the vm service for the current
2327 /// isolate.
2328 ///
2329 /// This function may be used by an embedder at a breakpoint to avoid
2330 /// pausing the vm service.
2331 ///
2332 /// This function can indirectly cause the message notify callback to
2333 /// be called.
2334 ///
2335 /// \return true if the vm service requests the program resume
2336 /// execution, false otherwise
2337 pub fn Dart_HandleServiceMessages() -> bool;
2338}
2339extern "C" {
2340 /// Does the current isolate have pending service messages?
2341 ///
2342 /// \return true if the isolate has pending service messages, false otherwise.
2343 pub fn Dart_HasServiceMessages() -> bool;
2344}
2345extern "C" {
2346 /// Processes any incoming messages for the current isolate.
2347 ///
2348 /// This function may only be used when the embedder has not provided
2349 /// an alternate message delivery mechanism with
2350 /// Dart_SetMessageCallbacks. It is provided for convenience.
2351 ///
2352 /// This function waits for incoming messages for the current
2353 /// isolate. As new messages arrive, they are handled using
2354 /// Dart_HandleMessage. The routine exits when all ports to the
2355 /// current isolate are closed.
2356 ///
2357 /// \return A valid handle if the run loop exited successfully. If an
2358 /// exception or other error occurs while processing messages, an
2359 /// error handle is returned.
2360 pub fn Dart_RunLoop() -> Dart_Handle;
2361}
2362extern "C" {
2363 /// Lets the VM run message processing for the isolate.
2364 ///
2365 /// This function expects there to a current isolate and the current isolate
2366 /// must not have an active api scope. The VM will take care of making the
2367 /// isolate runnable (if not already), handles its message loop and will take
2368 /// care of shutting the isolate down once it's done.
2369 ///
2370 /// \param errors_are_fatal Whether uncaught errors should be fatal.
2371 /// \param on_error_port A port to notify on uncaught errors (or ILLEGAL_PORT).
2372 /// \param on_exit_port A port to notify on exit (or ILLEGAL_PORT).
2373 /// \param error A non-NULL pointer which will hold an error message if the call
2374 /// fails. The error has to be free()ed by the caller.
2375 ///
2376 /// \return If successful the VM takes ownership of the isolate and takes care
2377 /// of its message loop. If not successful the caller retains ownership of the
2378 /// isolate.
2379 pub fn Dart_RunLoopAsync(
2380 errors_are_fatal: bool, on_error_port: Dart_Port, on_exit_port: Dart_Port, error: *mut *mut ::core::ffi::c_char,
2381 ) -> bool;
2382}
2383extern "C" {
2384 /// Gets the main port id for the current isolate.
2385 pub fn Dart_GetMainPortId() -> Dart_Port;
2386}
2387extern "C" {
2388 /// Does the current isolate have live ReceivePorts?
2389 ///
2390 /// A ReceivePort is live when it has not been closed.
2391 pub fn Dart_HasLivePorts() -> bool;
2392}
2393extern "C" {
2394 /// Posts a message for some isolate. The message is a serialized
2395 /// object.
2396 ///
2397 /// Requires there to be a current isolate.
2398 ///
2399 /// For posting messages outside of an isolate see \ref Dart_PostCObject.
2400 ///
2401 /// \param port_id The destination port.
2402 /// \param object An object from the current isolate.
2403 ///
2404 /// \return True if the message was posted.
2405 pub fn Dart_Post(port_id: Dart_Port, object: Dart_Handle) -> bool;
2406}
2407extern "C" {
2408 /// Returns a new SendPort with the provided port id.
2409 ///
2410 /// \param port_id The destination port.
2411 ///
2412 /// \return A new SendPort if no errors occurs. Otherwise returns
2413 /// an error handle.
2414 pub fn Dart_NewSendPort(port_id: Dart_Port) -> Dart_Handle;
2415}
2416extern "C" {
2417 /// Gets the SendPort id for the provided SendPort.
2418 /// \param port A SendPort object whose id is desired.
2419 /// \param port_id Returns the id of the SendPort.
2420 /// \return Success if no error occurs. Otherwise returns
2421 /// an error handle.
2422 pub fn Dart_SendPortGetId(port: Dart_Handle, port_id: *mut Dart_Port) -> Dart_Handle;
2423}
2424extern "C" {
2425 /// Enters a new scope.
2426 ///
2427 /// All new local handles will be created in this scope. Additionally,
2428 /// some functions may return "scope allocated" memory which is only
2429 /// valid within this scope.
2430 ///
2431 /// Requires there to be a current isolate.
2432 pub fn Dart_EnterScope();
2433}
2434extern "C" {
2435 /// Exits a scope.
2436 ///
2437 /// The previous scope (if any) becomes the current scope.
2438 ///
2439 /// Requires there to be a current isolate.
2440 pub fn Dart_ExitScope();
2441}
2442extern "C" {
2443 /// The Dart VM uses "zone allocation" for temporary structures. Zones
2444 /// support very fast allocation of small chunks of memory. The chunks
2445 /// cannot be deallocated individually, but instead zones support
2446 /// deallocating all chunks in one fast operation.
2447 ///
2448 /// This function makes it possible for the embedder to allocate
2449 /// temporary data in the VMs zone allocator.
2450 ///
2451 /// Zone allocation is possible:
2452 /// 1. when inside a scope where local handles can be allocated
2453 /// 2. when processing a message from a native port in a native port handler
2454 ///
2455 /// All the memory allocated this way will be reclaimed either on the
2456 /// next call to Dart_ExitScope or when the native port handler exits.
2457 ///
2458 /// \param size Size of the memory to allocate.
2459 ///
2460 /// \return A pointer to the allocated memory. NULL if allocation
2461 /// failed. Failure might due to is no current VM zone.
2462 pub fn Dart_ScopeAllocate(size: isize) -> *mut u8;
2463}
2464extern "C" {
2465 /// Returns the null object.
2466 ///
2467 /// \return A handle to the null object.
2468 pub fn Dart_Null() -> Dart_Handle;
2469}
2470extern "C" {
2471 /// Is this object null?
2472 pub fn Dart_IsNull(object: Dart_Handle) -> bool;
2473}
2474extern "C" {
2475 /// Returns the empty string object.
2476 ///
2477 /// \return A handle to the empty string object.
2478 pub fn Dart_EmptyString() -> Dart_Handle;
2479}
2480extern "C" {
2481 /// Returns types that are not classes, and which therefore cannot be looked up
2482 /// as library members by Dart_GetType.
2483 ///
2484 /// \return A handle to the dynamic, void or Never type.
2485 pub fn Dart_TypeDynamic() -> Dart_Handle;
2486}
2487extern "C" {
2488 pub fn Dart_TypeVoid() -> Dart_Handle;
2489}
2490extern "C" {
2491 pub fn Dart_TypeNever() -> Dart_Handle;
2492}
2493extern "C" {
2494 /// Checks if the two objects are equal.
2495 ///
2496 /// The result of the comparison is returned through the 'equal'
2497 /// parameter. The return value itself is used to indicate success or
2498 /// failure, not equality.
2499 ///
2500 /// May generate an unhandled exception error.
2501 ///
2502 /// \param obj1 An object to be compared.
2503 /// \param obj2 An object to be compared.
2504 /// \param equal Returns the result of the equality comparison.
2505 ///
2506 /// \return A valid handle if no error occurs during the comparison.
2507 pub fn Dart_ObjectEquals(obj1: Dart_Handle, obj2: Dart_Handle, equal: *mut bool) -> Dart_Handle;
2508}
2509extern "C" {
2510 /// Is this object an instance of some type?
2511 ///
2512 /// The result of the test is returned through the 'instanceof' parameter.
2513 /// The return value itself is used to indicate success or failure.
2514 ///
2515 /// \param object An object.
2516 /// \param type A type.
2517 /// \param instanceof Return true if 'object' is an instance of type 'type'.
2518 ///
2519 /// \return A valid handle if no error occurs during the operation.
2520 pub fn Dart_ObjectIsType(object: Dart_Handle, type_: Dart_Handle, instanceof: *mut bool) -> Dart_Handle;
2521}
2522extern "C" {
2523 /// Query object type.
2524 ///
2525 /// \param object Some Object.
2526 ///
2527 /// \return true if Object is of the specified type.
2528 pub fn Dart_IsInstance(object: Dart_Handle) -> bool;
2529}
2530extern "C" {
2531 pub fn Dart_IsNumber(object: Dart_Handle) -> bool;
2532}
2533extern "C" {
2534 pub fn Dart_IsInteger(object: Dart_Handle) -> bool;
2535}
2536extern "C" {
2537 pub fn Dart_IsDouble(object: Dart_Handle) -> bool;
2538}
2539extern "C" {
2540 pub fn Dart_IsBoolean(object: Dart_Handle) -> bool;
2541}
2542extern "C" {
2543 pub fn Dart_IsString(object: Dart_Handle) -> bool;
2544}
2545extern "C" {
2546 pub fn Dart_IsStringLatin1(object: Dart_Handle) -> bool;
2547}
2548extern "C" {
2549 pub fn Dart_IsExternalString(object: Dart_Handle) -> bool;
2550}
2551extern "C" {
2552 pub fn Dart_IsList(object: Dart_Handle) -> bool;
2553}
2554extern "C" {
2555 pub fn Dart_IsMap(object: Dart_Handle) -> bool;
2556}
2557extern "C" {
2558 pub fn Dart_IsLibrary(object: Dart_Handle) -> bool;
2559}
2560extern "C" {
2561 pub fn Dart_IsType(handle: Dart_Handle) -> bool;
2562}
2563extern "C" {
2564 pub fn Dart_IsFunction(handle: Dart_Handle) -> bool;
2565}
2566extern "C" {
2567 pub fn Dart_IsVariable(handle: Dart_Handle) -> bool;
2568}
2569extern "C" {
2570 pub fn Dart_IsTypeVariable(handle: Dart_Handle) -> bool;
2571}
2572extern "C" {
2573 pub fn Dart_IsClosure(object: Dart_Handle) -> bool;
2574}
2575extern "C" {
2576 pub fn Dart_IsTypedData(object: Dart_Handle) -> bool;
2577}
2578extern "C" {
2579 pub fn Dart_IsByteBuffer(object: Dart_Handle) -> bool;
2580}
2581extern "C" {
2582 pub fn Dart_IsFuture(object: Dart_Handle) -> bool;
2583}
2584extern "C" {
2585 /// Gets the type of a Dart language object.
2586 ///
2587 /// \param instance Some Dart object.
2588 ///
2589 /// \return If no error occurs, the type is returned. Otherwise an
2590 /// error handle is returned.
2591 pub fn Dart_InstanceGetType(instance: Dart_Handle) -> Dart_Handle;
2592}
2593extern "C" {
2594 /// Returns the name for the provided class type.
2595 ///
2596 /// \return A valid string handle if no error occurs during the
2597 /// operation.
2598 pub fn Dart_ClassName(cls_type: Dart_Handle) -> Dart_Handle;
2599}
2600extern "C" {
2601 /// Returns the name for the provided function or method.
2602 ///
2603 /// \return A valid string handle if no error occurs during the
2604 /// operation.
2605 pub fn Dart_FunctionName(function: Dart_Handle) -> Dart_Handle;
2606}
2607extern "C" {
2608 /// Returns a handle to the owner of a function.
2609 ///
2610 /// The owner of an instance method or a static method is its defining
2611 /// class. The owner of a top-level function is its defining
2612 /// library. The owner of the function of a non-implicit closure is the
2613 /// function of the method or closure that defines the non-implicit
2614 /// closure.
2615 ///
2616 /// \return A valid handle to the owner of the function, or an error
2617 /// handle if the argument is not a valid handle to a function.
2618 pub fn Dart_FunctionOwner(function: Dart_Handle) -> Dart_Handle;
2619}
2620extern "C" {
2621 /// Determines whether a function handle refers to a static function
2622 /// of method.
2623 ///
2624 /// For the purposes of the embedding API, a top-level function is
2625 /// implicitly declared static.
2626 ///
2627 /// \param function A handle to a function or method declaration.
2628 /// \param is_static Returns whether the function or method is declared static.
2629 ///
2630 /// \return A valid handle if no error occurs during the operation.
2631 pub fn Dart_FunctionIsStatic(function: Dart_Handle, is_static: *mut bool) -> Dart_Handle;
2632}
2633extern "C" {
2634 /// Is this object a closure resulting from a tear-off (closurized method)?
2635 ///
2636 /// Returns true for closures produced when an ordinary method is accessed
2637 /// through a getter call. Returns false otherwise, in particular for closures
2638 /// produced from local function declarations.
2639 ///
2640 /// \param object Some Object.
2641 ///
2642 /// \return true if Object is a tear-off.
2643 pub fn Dart_IsTearOff(object: Dart_Handle) -> bool;
2644}
2645extern "C" {
2646 /// Retrieves the function of a closure.
2647 ///
2648 /// \return A handle to the function of the closure, or an error handle if the
2649 /// argument is not a closure.
2650 pub fn Dart_ClosureFunction(closure: Dart_Handle) -> Dart_Handle;
2651}
2652extern "C" {
2653 /// Returns a handle to the library which contains class.
2654 ///
2655 /// \return A valid handle to the library with owns class, null if the class
2656 /// has no library or an error handle if the argument is not a valid handle
2657 /// to a class type.
2658 pub fn Dart_ClassLibrary(cls_type: Dart_Handle) -> Dart_Handle;
2659}
2660extern "C" {
2661 /// Does this Integer fit into a 64-bit signed integer?
2662 ///
2663 /// \param integer An integer.
2664 /// \param fits Returns true if the integer fits into a 64-bit signed integer.
2665 ///
2666 /// \return A valid handle if no error occurs during the operation.
2667 pub fn Dart_IntegerFitsIntoInt64(integer: Dart_Handle, fits: *mut bool) -> Dart_Handle;
2668}
2669extern "C" {
2670 /// Does this Integer fit into a 64-bit unsigned integer?
2671 ///
2672 /// \param integer An integer.
2673 /// \param fits Returns true if the integer fits into a 64-bit unsigned integer.
2674 ///
2675 /// \return A valid handle if no error occurs during the operation.
2676 pub fn Dart_IntegerFitsIntoUint64(integer: Dart_Handle, fits: *mut bool) -> Dart_Handle;
2677}
2678extern "C" {
2679 /// Returns an Integer with the provided value.
2680 ///
2681 /// \param value The value of the integer.
2682 ///
2683 /// \return The Integer object if no error occurs. Otherwise returns
2684 /// an error handle.
2685 pub fn Dart_NewInteger(value: i64) -> Dart_Handle;
2686}
2687extern "C" {
2688 /// Returns an Integer with the provided value.
2689 ///
2690 /// \param value The unsigned value of the integer.
2691 ///
2692 /// \return The Integer object if no error occurs. Otherwise returns
2693 /// an error handle.
2694 pub fn Dart_NewIntegerFromUint64(value: u64) -> Dart_Handle;
2695}
2696extern "C" {
2697 /// Returns an Integer with the provided value.
2698 ///
2699 /// \param value The value of the integer represented as a C string
2700 /// containing a hexadecimal number.
2701 ///
2702 /// \return The Integer object if no error occurs. Otherwise returns
2703 /// an error handle.
2704 pub fn Dart_NewIntegerFromHexCString(value: *const ::core::ffi::c_char) -> Dart_Handle;
2705}
2706extern "C" {
2707 /// Gets the value of an Integer.
2708 ///
2709 /// The integer must fit into a 64-bit signed integer, otherwise an error occurs.
2710 ///
2711 /// \param integer An Integer.
2712 /// \param value Returns the value of the Integer.
2713 ///
2714 /// \return A valid handle if no error occurs during the operation.
2715 pub fn Dart_IntegerToInt64(integer: Dart_Handle, value: *mut i64) -> Dart_Handle;
2716}
2717extern "C" {
2718 /// Gets the value of an Integer.
2719 ///
2720 /// The integer must fit into a 64-bit unsigned integer, otherwise an
2721 /// error occurs.
2722 ///
2723 /// \param integer An Integer.
2724 /// \param value Returns the value of the Integer.
2725 ///
2726 /// \return A valid handle if no error occurs during the operation.
2727 pub fn Dart_IntegerToUint64(integer: Dart_Handle, value: *mut u64) -> Dart_Handle;
2728}
2729extern "C" {
2730 /// Gets the value of an integer as a hexadecimal C string.
2731 ///
2732 /// \param integer An Integer.
2733 /// \param value Returns the value of the Integer as a hexadecimal C
2734 /// string. This C string is scope allocated and is only valid until
2735 /// the next call to Dart_ExitScope.
2736 ///
2737 /// \return A valid handle if no error occurs during the operation.
2738 pub fn Dart_IntegerToHexCString(integer: Dart_Handle, value: *mut *const ::core::ffi::c_char) -> Dart_Handle;
2739}
2740extern "C" {
2741 /// Returns a Double with the provided value.
2742 ///
2743 /// \param value A double.
2744 ///
2745 /// \return The Double object if no error occurs. Otherwise returns
2746 /// an error handle.
2747 pub fn Dart_NewDouble(value: f64) -> Dart_Handle;
2748}
2749extern "C" {
2750 /// Gets the value of a Double
2751 ///
2752 /// \param double_obj A Double
2753 /// \param value Returns the value of the Double.
2754 ///
2755 /// \return A valid handle if no error occurs during the operation.
2756 pub fn Dart_DoubleValue(double_obj: Dart_Handle, value: *mut f64) -> Dart_Handle;
2757}
2758extern "C" {
2759 /// Returns a closure of static function 'function_name' in the class 'class_name'
2760 /// in the exported namespace of specified 'library'.
2761 ///
2762 /// \param library Library object
2763 /// \param cls_type Type object representing a Class
2764 /// \param function_name Name of the static function in the class
2765 ///
2766 /// \return A valid Dart instance if no error occurs during the operation.
2767 pub fn Dart_GetStaticMethodClosure(
2768 library: Dart_Handle, cls_type: Dart_Handle, function_name: Dart_Handle,
2769 ) -> Dart_Handle;
2770}
2771extern "C" {
2772 /// Returns the True object.
2773 ///
2774 /// Requires there to be a current isolate.
2775 ///
2776 /// \return A handle to the True object.
2777 pub fn Dart_True() -> Dart_Handle;
2778}
2779extern "C" {
2780 /// Returns the False object.
2781 ///
2782 /// Requires there to be a current isolate.
2783 ///
2784 /// \return A handle to the False object.
2785 pub fn Dart_False() -> Dart_Handle;
2786}
2787extern "C" {
2788 /// Returns a Boolean with the provided value.
2789 ///
2790 /// \param value true or false.
2791 ///
2792 /// \return The Boolean object if no error occurs. Otherwise returns
2793 /// an error handle.
2794 pub fn Dart_NewBoolean(value: bool) -> Dart_Handle;
2795}
2796extern "C" {
2797 /// Gets the value of a Boolean
2798 ///
2799 /// \param boolean_obj A Boolean
2800 /// \param value Returns the value of the Boolean.
2801 ///
2802 /// \return A valid handle if no error occurs during the operation.
2803 pub fn Dart_BooleanValue(boolean_obj: Dart_Handle, value: *mut bool) -> Dart_Handle;
2804}
2805extern "C" {
2806 /// Gets the length of a String.
2807 ///
2808 /// \param str A String.
2809 /// \param length Returns the length of the String.
2810 ///
2811 /// \return A valid handle if no error occurs during the operation.
2812 pub fn Dart_StringLength(str_: Dart_Handle, length: *mut isize) -> Dart_Handle;
2813}
2814extern "C" {
2815 /// Returns a String built from the provided C string
2816 /// (There is an implicit assumption that the C string passed in contains
2817 /// UTF-8 encoded characters and '\0' is considered as a termination
2818 /// character).
2819 ///
2820 /// \param str A C String
2821 ///
2822 /// \return The String object if no error occurs. Otherwise returns
2823 /// an error handle.
2824 pub fn Dart_NewStringFromCString(str_: *const ::core::ffi::c_char) -> Dart_Handle;
2825}
2826extern "C" {
2827 /// Returns a String built from an array of UTF-8 encoded characters.
2828 ///
2829 /// \param utf8_array An array of UTF-8 encoded characters.
2830 /// \param length The length of the codepoints array.
2831 ///
2832 /// \return The String object if no error occurs. Otherwise returns
2833 /// an error handle.
2834 pub fn Dart_NewStringFromUTF8(utf8_array: *const u8, length: isize) -> Dart_Handle;
2835}
2836extern "C" {
2837 /// Returns a String built from an array of UTF-16 encoded characters.
2838 ///
2839 /// \param utf16_array An array of UTF-16 encoded characters.
2840 /// \param length The length of the codepoints array.
2841 ///
2842 /// \return The String object if no error occurs. Otherwise returns
2843 /// an error handle.
2844 pub fn Dart_NewStringFromUTF16(utf16_array: *const u16, length: isize) -> Dart_Handle;
2845}
2846extern "C" {
2847 /// Returns a String built from an array of UTF-32 encoded characters.
2848 ///
2849 /// \param utf32_array An array of UTF-32 encoded characters.
2850 /// \param length The length of the codepoints array.
2851 ///
2852 /// \return The String object if no error occurs. Otherwise returns
2853 /// an error handle.
2854 pub fn Dart_NewStringFromUTF32(utf32_array: *const i32, length: isize) -> Dart_Handle;
2855}
2856extern "C" {
2857 /// Returns a String which references an external array of
2858 /// Latin-1 (ISO-8859-1) encoded characters.
2859 ///
2860 /// \param latin1_array Array of Latin-1 encoded characters. This must not move.
2861 /// \param length The length of the characters array.
2862 /// \param peer An external pointer to associate with this string.
2863 /// \param external_allocation_size The number of externally allocated
2864 /// bytes for peer. Used to inform the garbage collector.
2865 /// \param callback A callback to be called when this string is finalized.
2866 ///
2867 /// \return The String object if no error occurs. Otherwise returns
2868 /// an error handle.
2869 pub fn Dart_NewExternalLatin1String(
2870 latin1_array: *const u8, length: isize, peer: *mut ::core::ffi::c_void, external_allocation_size: isize,
2871 callback: Dart_HandleFinalizer,
2872 ) -> Dart_Handle;
2873}
2874extern "C" {
2875 /// Returns a String which references an external array of UTF-16 encoded
2876 /// characters.
2877 ///
2878 /// \param utf16_array An array of UTF-16 encoded characters. This must not move.
2879 /// \param length The length of the characters array.
2880 /// \param peer An external pointer to associate with this string.
2881 /// \param external_allocation_size The number of externally allocated
2882 /// bytes for peer. Used to inform the garbage collector.
2883 /// \param callback A callback to be called when this string is finalized.
2884 ///
2885 /// \return The String object if no error occurs. Otherwise returns
2886 /// an error handle.
2887 pub fn Dart_NewExternalUTF16String(
2888 utf16_array: *const u16, length: isize, peer: *mut ::core::ffi::c_void, external_allocation_size: isize,
2889 callback: Dart_HandleFinalizer,
2890 ) -> Dart_Handle;
2891}
2892extern "C" {
2893 /// Gets the C string representation of a String.
2894 /// (It is a sequence of UTF-8 encoded values with a '\0' termination.)
2895 ///
2896 /// \param str A string.
2897 /// \param cstr Returns the String represented as a C string.
2898 /// This C string is scope allocated and is only valid until
2899 /// the next call to Dart_ExitScope.
2900 ///
2901 /// \return A valid handle if no error occurs during the operation.
2902 pub fn Dart_StringToCString(str_: Dart_Handle, cstr: *mut *const ::core::ffi::c_char) -> Dart_Handle;
2903}
2904extern "C" {
2905 /// Gets a UTF-8 encoded representation of a String.
2906 ///
2907 /// Any unpaired surrogate code points in the string will be converted as
2908 /// replacement characters (U+FFFD, 0xEF 0xBF 0xBD in UTF-8). If you need
2909 /// to preserve unpaired surrogates, use the Dart_StringToUTF16 function.
2910 ///
2911 /// \param str A string.
2912 /// \param utf8_array Returns the String represented as UTF-8 code
2913 /// units. This UTF-8 array is scope allocated and is only valid
2914 /// until the next call to Dart_ExitScope.
2915 /// \param length Used to return the length of the array which was
2916 /// actually used.
2917 ///
2918 /// \return A valid handle if no error occurs during the operation.
2919 pub fn Dart_StringToUTF8(str_: Dart_Handle, utf8_array: *mut *mut u8, length: *mut isize) -> Dart_Handle;
2920}
2921extern "C" {
2922 /// Gets the data corresponding to the string object. This function returns
2923 /// the data only for Latin-1 (ISO-8859-1) string objects. For all other
2924 /// string objects it returns an error.
2925 ///
2926 /// \param str A string.
2927 /// \param latin1_array An array allocated by the caller, used to return
2928 /// the string data.
2929 /// \param length Used to pass in the length of the provided array.
2930 /// Used to return the length of the array which was actually used.
2931 ///
2932 /// \return A valid handle if no error occurs during the operation.
2933 pub fn Dart_StringToLatin1(str_: Dart_Handle, latin1_array: *mut u8, length: *mut isize) -> Dart_Handle;
2934}
2935extern "C" {
2936 /// Gets the UTF-16 encoded representation of a string.
2937 ///
2938 /// \param str A string.
2939 /// \param utf16_array An array allocated by the caller, used to return
2940 /// the array of UTF-16 encoded characters.
2941 /// \param length Used to pass in the length of the provided array.
2942 /// Used to return the length of the array which was actually used.
2943 ///
2944 /// \return A valid handle if no error occurs during the operation.
2945 pub fn Dart_StringToUTF16(str_: Dart_Handle, utf16_array: *mut u16, length: *mut isize) -> Dart_Handle;
2946}
2947extern "C" {
2948 /// Gets the storage size in bytes of a String.
2949 ///
2950 /// \param str A String.
2951 /// \param size Returns the storage size in bytes of the String.
2952 /// This is the size in bytes needed to store the String.
2953 ///
2954 /// \return A valid handle if no error occurs during the operation.
2955 pub fn Dart_StringStorageSize(str_: Dart_Handle, size: *mut isize) -> Dart_Handle;
2956}
2957extern "C" {
2958 /// Retrieves some properties associated with a String.
2959 /// Properties retrieved are:
2960 /// - character size of the string (one or two byte)
2961 /// - length of the string
2962 /// - peer pointer of string if it is an external string.
2963 /// \param str A String.
2964 /// \param char_size Returns the character size of the String.
2965 /// \param str_len Returns the length of the String.
2966 /// \param peer Returns the peer pointer associated with the String or 0 if
2967 /// there is no peer pointer for it.
2968 /// \return Success if no error occurs. Otherwise returns
2969 /// an error handle.
2970 pub fn Dart_StringGetProperties(
2971 str_: Dart_Handle, char_size: *mut isize, str_len: *mut isize, peer: *mut *mut ::core::ffi::c_void,
2972 ) -> Dart_Handle;
2973}
2974extern "C" {
2975 /// Returns a List<dynamic> of the desired length.
2976 ///
2977 /// \param length The length of the list.
2978 ///
2979 /// \return The List object if no error occurs. Otherwise returns
2980 /// an error handle.
2981 pub fn Dart_NewList(length: isize) -> Dart_Handle;
2982}
2983extern "C" {
2984 /// Returns a List of the desired length with the desired legacy element type.
2985 ///
2986 /// \param element_type_id The type of elements of the list.
2987 /// \param length The length of the list.
2988 ///
2989 /// \return The List object if no error occurs. Otherwise returns an error
2990 /// handle.
2991 pub fn Dart_NewListOf(element_type_id: Dart_CoreType_Id, length: isize) -> Dart_Handle;
2992}
2993extern "C" {
2994 /// Returns a List of the desired length with the desired element type.
2995 ///
2996 /// \param element_type Handle to a nullable type object. E.g., from
2997 /// Dart_GetType or Dart_GetNullableType.
2998 ///
2999 /// \param length The length of the list.
3000 ///
3001 /// \return The List object if no error occurs. Otherwise returns
3002 /// an error handle.
3003 pub fn Dart_NewListOfType(element_type: Dart_Handle, length: isize) -> Dart_Handle;
3004}
3005extern "C" {
3006 /// Returns a List of the desired length with the desired element type, filled
3007 /// with the provided object.
3008 ///
3009 /// \param element_type Handle to a type object. E.g., from Dart_GetType.
3010 ///
3011 /// \param fill_object Handle to an object of type 'element_type' that will be
3012 /// used to populate the list. This parameter can only be Dart_Null() if the
3013 /// length of the list is 0 or 'element_type' is a nullable type.
3014 ///
3015 /// \param length The length of the list.
3016 ///
3017 /// \return The List object if no error occurs. Otherwise returns
3018 /// an error handle.
3019 pub fn Dart_NewListOfTypeFilled(element_type: Dart_Handle, fill_object: Dart_Handle, length: isize) -> Dart_Handle;
3020}
3021extern "C" {
3022 /// Gets the length of a List.
3023 ///
3024 /// May generate an unhandled exception error.
3025 ///
3026 /// \param list A List.
3027 /// \param length Returns the length of the List.
3028 ///
3029 /// \return A valid handle if no error occurs during the operation.
3030 pub fn Dart_ListLength(list: Dart_Handle, length: *mut isize) -> Dart_Handle;
3031}
3032extern "C" {
3033 /// Gets the Object at some index of a List.
3034 ///
3035 /// If the index is out of bounds, an error occurs.
3036 ///
3037 /// May generate an unhandled exception error.
3038 ///
3039 /// \param list A List.
3040 /// \param index A valid index into the List.
3041 ///
3042 /// \return The Object in the List at the specified index if no error
3043 /// occurs. Otherwise returns an error handle.
3044 pub fn Dart_ListGetAt(list: Dart_Handle, index: isize) -> Dart_Handle;
3045}
3046extern "C" {
3047 /// Gets a range of Objects from a List.
3048 ///
3049 /// If any of the requested index values are out of bounds, an error occurs.
3050 ///
3051 /// May generate an unhandled exception error.
3052 ///
3053 /// \param list A List.
3054 /// \param offset The offset of the first item to get.
3055 /// \param length The number of items to get.
3056 /// \param result A pointer to fill with the objects.
3057 ///
3058 /// \return Success if no error occurs during the operation.
3059 pub fn Dart_ListGetRange(list: Dart_Handle, offset: isize, length: isize, result: *mut Dart_Handle) -> Dart_Handle;
3060}
3061extern "C" {
3062 /// Sets the Object at some index of a List.
3063 ///
3064 /// If the index is out of bounds, an error occurs.
3065 ///
3066 /// May generate an unhandled exception error.
3067 ///
3068 /// \param list A List.
3069 /// \param index A valid index into the List.
3070 /// \param value The Object to put in the List.
3071 ///
3072 /// \return A valid handle if no error occurs during the operation.
3073 pub fn Dart_ListSetAt(list: Dart_Handle, index: isize, value: Dart_Handle) -> Dart_Handle;
3074}
3075extern "C" {
3076 /// May generate an unhandled exception error.
3077 pub fn Dart_ListGetAsBytes(list: Dart_Handle, offset: isize, native_array: *mut u8, length: isize) -> Dart_Handle;
3078}
3079extern "C" {
3080 /// May generate an unhandled exception error.
3081 pub fn Dart_ListSetAsBytes(list: Dart_Handle, offset: isize, native_array: *const u8, length: isize)
3082 -> Dart_Handle;
3083}
3084extern "C" {
3085 /// Gets the Object at some key of a Map.
3086 ///
3087 /// May generate an unhandled exception error.
3088 ///
3089 /// \param map A Map.
3090 /// \param key An Object.
3091 ///
3092 /// \return The value in the map at the specified key, null if the map does not
3093 /// contain the key, or an error handle.
3094 pub fn Dart_MapGetAt(map: Dart_Handle, key: Dart_Handle) -> Dart_Handle;
3095}
3096extern "C" {
3097 /// Returns whether the Map contains a given key.
3098 ///
3099 /// May generate an unhandled exception error.
3100 ///
3101 /// \param map A Map.
3102 ///
3103 /// \return A handle on a boolean indicating whether map contains the key.
3104 /// Otherwise returns an error handle.
3105 pub fn Dart_MapContainsKey(map: Dart_Handle, key: Dart_Handle) -> Dart_Handle;
3106}
3107extern "C" {
3108 /// Gets the list of keys of a Map.
3109 ///
3110 /// May generate an unhandled exception error.
3111 ///
3112 /// \param map A Map.
3113 ///
3114 /// \return The list of key Objects if no error occurs. Otherwise returns an
3115 /// error handle.
3116 pub fn Dart_MapKeys(map: Dart_Handle) -> Dart_Handle;
3117}
3118extern "C" {
3119 /// Return type if this object is a TypedData object.
3120 ///
3121 /// \return kInvalid if the object is not a TypedData object or the appropriate
3122 /// Dart_TypedData_Type.
3123 pub fn Dart_GetTypeOfTypedData(object: Dart_Handle) -> Dart_TypedData_Type;
3124}
3125extern "C" {
3126 /// Return type if this object is an external TypedData object.
3127 ///
3128 /// \return kInvalid if the object is not an external TypedData object or
3129 /// the appropriate Dart_TypedData_Type.
3130 pub fn Dart_GetTypeOfExternalTypedData(object: Dart_Handle) -> Dart_TypedData_Type;
3131}
3132extern "C" {
3133 /// Returns a TypedData object of the desired length and type.
3134 ///
3135 /// \param type The type of the TypedData object.
3136 /// \param length The length of the TypedData object (length in type units).
3137 ///
3138 /// \return The TypedData object if no error occurs. Otherwise returns
3139 /// an error handle.
3140 pub fn Dart_NewTypedData(type_: Dart_TypedData_Type, length: isize) -> Dart_Handle;
3141}
3142extern "C" {
3143 /// Returns a TypedData object which references an external data array.
3144 ///
3145 /// \param type The type of the data array.
3146 /// \param data A data array. This array must not move.
3147 /// \param length The length of the data array (length in type units).
3148 ///
3149 /// \return The TypedData object if no error occurs. Otherwise returns
3150 /// an error handle.
3151 pub fn Dart_NewExternalTypedData(
3152 type_: Dart_TypedData_Type, data: *mut ::core::ffi::c_void, length: isize,
3153 ) -> Dart_Handle;
3154}
3155extern "C" {
3156 /// Returns a TypedData object which references an external data array.
3157 ///
3158 /// \param type The type of the data array.
3159 /// \param data A data array. This array must not move.
3160 /// \param length The length of the data array (length in type units).
3161 /// \param peer A pointer to a native object or NULL. This value is
3162 /// provided to callback when it is invoked.
3163 /// \param external_allocation_size The number of externally allocated
3164 /// bytes for peer. Used to inform the garbage collector.
3165 /// \param callback A function pointer that will be invoked sometime
3166 /// after the object is garbage collected, unless the handle has been deleted.
3167 /// A valid callback needs to be specified it cannot be NULL.
3168 ///
3169 /// \return The TypedData object if no error occurs. Otherwise returns
3170 /// an error handle.
3171 pub fn Dart_NewExternalTypedDataWithFinalizer(
3172 type_: Dart_TypedData_Type, data: *mut ::core::ffi::c_void, length: isize, peer: *mut ::core::ffi::c_void,
3173 external_allocation_size: isize, callback: Dart_HandleFinalizer,
3174 ) -> Dart_Handle;
3175}
3176extern "C" {
3177 pub fn Dart_NewUnmodifiableExternalTypedDataWithFinalizer(
3178 type_: Dart_TypedData_Type, data: *const ::core::ffi::c_void, length: isize, peer: *mut ::core::ffi::c_void,
3179 external_allocation_size: isize, callback: Dart_HandleFinalizer,
3180 ) -> Dart_Handle;
3181}
3182extern "C" {
3183 /// Returns a ByteBuffer object for the typed data.
3184 ///
3185 /// \param typed_data The TypedData object.
3186 ///
3187 /// \return The ByteBuffer object if no error occurs. Otherwise returns
3188 /// an error handle.
3189 pub fn Dart_NewByteBuffer(typed_data: Dart_Handle) -> Dart_Handle;
3190}
3191extern "C" {
3192 /// Acquires access to the internal data address of a TypedData object.
3193 ///
3194 /// \param object The typed data object whose internal data address is to
3195 /// be accessed.
3196 /// \param type The type of the object is returned here.
3197 /// \param data The internal data address is returned here.
3198 /// \param len Size of the typed array is returned here.
3199 ///
3200 /// Notes:
3201 /// When the internal address of the object is acquired any calls to a
3202 /// Dart API function that could potentially allocate an object or run
3203 /// any Dart code will return an error.
3204 ///
3205 /// Any Dart API functions for accessing the data should not be called
3206 /// before the corresponding release. In particular, the object should
3207 /// not be acquired again before its release. This leads to undefined
3208 /// behavior.
3209 ///
3210 /// \return Success if the internal data address is acquired successfully.
3211 /// Otherwise, returns an error handle.
3212 pub fn Dart_TypedDataAcquireData(
3213 object: Dart_Handle, type_: *mut Dart_TypedData_Type, data: *mut *mut ::core::ffi::c_void, len: *mut isize,
3214 ) -> Dart_Handle;
3215}
3216extern "C" {
3217 /// Releases access to the internal data address that was acquired earlier using
3218 /// Dart_TypedDataAcquireData.
3219 ///
3220 /// \param object The typed data object whose internal data address is to be
3221 /// released.
3222 ///
3223 /// \return Success if the internal data address is released successfully.
3224 /// Otherwise, returns an error handle.
3225 pub fn Dart_TypedDataReleaseData(object: Dart_Handle) -> Dart_Handle;
3226}
3227extern "C" {
3228 /// Returns the TypedData object associated with the ByteBuffer object.
3229 ///
3230 /// \param byte_buffer The ByteBuffer object.
3231 ///
3232 /// \return The TypedData object if no error occurs. Otherwise returns
3233 /// an error handle.
3234 pub fn Dart_GetDataFromByteBuffer(byte_buffer: Dart_Handle) -> Dart_Handle;
3235}
3236extern "C" {
3237 /// Invokes a constructor, creating a new object.
3238 ///
3239 /// This function allows hidden constructors (constructors with leading
3240 /// underscores) to be called.
3241 ///
3242 /// \param type Type of object to be constructed.
3243 /// \param constructor_name The name of the constructor to invoke. Use
3244 /// Dart_Null() or Dart_EmptyString() to invoke the unnamed constructor.
3245 /// This name should not include the name of the class.
3246 /// \param number_of_arguments Size of the arguments array.
3247 /// \param arguments An array of arguments to the constructor.
3248 ///
3249 /// \return If the constructor is called and completes successfully,
3250 /// then the new object. If an error occurs during execution, then an
3251 /// error handle is returned.
3252 pub fn Dart_New(
3253 type_: Dart_Handle, constructor_name: Dart_Handle, number_of_arguments: ::core::ffi::c_int,
3254 arguments: *mut Dart_Handle,
3255 ) -> Dart_Handle;
3256}
3257extern "C" {
3258 /// Allocate a new object without invoking a constructor.
3259 ///
3260 /// \param type The type of an object to be allocated.
3261 ///
3262 /// \return The new object. If an error occurs during execution, then an
3263 /// error handle is returned.
3264 pub fn Dart_Allocate(type_: Dart_Handle) -> Dart_Handle;
3265}
3266extern "C" {
3267 /// Allocate a new object without invoking a constructor, and sets specified
3268 /// native fields.
3269 ///
3270 /// \param type The type of an object to be allocated.
3271 /// \param num_native_fields The number of native fields to set.
3272 /// \param native_fields An array containing the value of native fields.
3273 ///
3274 /// \return The new object. If an error occurs during execution, then an
3275 /// error handle is returned.
3276 pub fn Dart_AllocateWithNativeFields(
3277 type_: Dart_Handle, num_native_fields: isize, native_fields: *const isize,
3278 ) -> Dart_Handle;
3279}
3280extern "C" {
3281 /// Invokes a method or function.
3282 ///
3283 /// The 'target' parameter may be an object, type, or library. If
3284 /// 'target' is an object, then this function will invoke an instance
3285 /// method. If 'target' is a type, then this function will invoke a
3286 /// static method. If 'target' is a library, then this function will
3287 /// invoke a top-level function from that library.
3288 /// NOTE: This API call cannot be used to invoke methods of a type object.
3289 ///
3290 /// This function ignores visibility (leading underscores in names).
3291 ///
3292 /// May generate an unhandled exception error.
3293 ///
3294 /// \param target An object, type, or library.
3295 /// \param name The name of the function or method to invoke.
3296 /// \param number_of_arguments Size of the arguments array.
3297 /// \param arguments An array of arguments to the function.
3298 ///
3299 /// \return If the function or method is called and completes
3300 /// successfully, then the return value is returned. If an error
3301 /// occurs during execution, then an error handle is returned.
3302 pub fn Dart_Invoke(
3303 target: Dart_Handle, name: Dart_Handle, number_of_arguments: ::core::ffi::c_int, arguments: *mut Dart_Handle,
3304 ) -> Dart_Handle;
3305}
3306extern "C" {
3307 /// Invokes a Closure with the given arguments.
3308 ///
3309 /// May generate an unhandled exception error.
3310 ///
3311 /// \return If no error occurs during execution, then the result of
3312 /// invoking the closure is returned. If an error occurs during
3313 /// execution, then an error handle is returned.
3314 pub fn Dart_InvokeClosure(
3315 closure: Dart_Handle, number_of_arguments: ::core::ffi::c_int, arguments: *mut Dart_Handle,
3316 ) -> Dart_Handle;
3317}
3318extern "C" {
3319 /// Invokes a Generative Constructor on an object that was previously
3320 /// allocated using Dart_Allocate/Dart_AllocateWithNativeFields.
3321 ///
3322 /// The 'object' parameter must be an object.
3323 ///
3324 /// This function ignores visibility (leading underscores in names).
3325 ///
3326 /// May generate an unhandled exception error.
3327 ///
3328 /// \param object An object.
3329 /// \param name The name of the constructor to invoke.
3330 /// Use Dart_Null() or Dart_EmptyString() to invoke the unnamed constructor.
3331 /// \param number_of_arguments Size of the arguments array.
3332 /// \param arguments An array of arguments to the function.
3333 ///
3334 /// \return If the constructor is called and completes
3335 /// successfully, then the object is returned. If an error
3336 /// occurs during execution, then an error handle is returned.
3337 pub fn Dart_InvokeConstructor(
3338 object: Dart_Handle, name: Dart_Handle, number_of_arguments: ::core::ffi::c_int, arguments: *mut Dart_Handle,
3339 ) -> Dart_Handle;
3340}
3341extern "C" {
3342 /// Gets the value of a field.
3343 ///
3344 /// The 'container' parameter may be an object, type, or library. If
3345 /// 'container' is an object, then this function will access an
3346 /// instance field. If 'container' is a type, then this function will
3347 /// access a static field. If 'container' is a library, then this
3348 /// function will access a top-level variable.
3349 /// NOTE: This API call cannot be used to access fields of a type object.
3350 ///
3351 /// This function ignores field visibility (leading underscores in names).
3352 ///
3353 /// May generate an unhandled exception error.
3354 ///
3355 /// \param container An object, type, or library.
3356 /// \param name A field name.
3357 ///
3358 /// \return If no error occurs, then the value of the field is
3359 /// returned. Otherwise an error handle is returned.
3360 pub fn Dart_GetField(container: Dart_Handle, name: Dart_Handle) -> Dart_Handle;
3361}
3362extern "C" {
3363 /// Sets the value of a field.
3364 ///
3365 /// The 'container' parameter may actually be an object, type, or
3366 /// library. If 'container' is an object, then this function will
3367 /// access an instance field. If 'container' is a type, then this
3368 /// function will access a static field. If 'container' is a library,
3369 /// then this function will access a top-level variable.
3370 /// NOTE: This API call cannot be used to access fields of a type object.
3371 ///
3372 /// This function ignores field visibility (leading underscores in names).
3373 ///
3374 /// May generate an unhandled exception error.
3375 ///
3376 /// \param container An object, type, or library.
3377 /// \param name A field name.
3378 /// \param value The new field value.
3379 ///
3380 /// \return A valid handle if no error occurs.
3381 pub fn Dart_SetField(container: Dart_Handle, name: Dart_Handle, value: Dart_Handle) -> Dart_Handle;
3382}
3383extern "C" {
3384 /// Throws an exception.
3385 ///
3386 /// This function causes a Dart language exception to be thrown. This
3387 /// will proceed in the standard way, walking up Dart frames until an
3388 /// appropriate 'catch' block is found, executing 'finally' blocks,
3389 /// etc.
3390 ///
3391 /// If an error handle is passed into this function, the error is
3392 /// propagated immediately. See Dart_PropagateError for a discussion
3393 /// of error propagation.
3394 ///
3395 /// If successful, this function does not return. Note that this means
3396 /// that the destructors of any stack-allocated C++ objects will not be
3397 /// called. If there are no Dart frames on the stack, an error occurs.
3398 ///
3399 /// \return An error handle if the exception was not thrown.
3400 /// Otherwise the function does not return.
3401 pub fn Dart_ThrowException(exception: Dart_Handle) -> Dart_Handle;
3402}
3403extern "C" {
3404 /// Rethrows an exception.
3405 ///
3406 /// Rethrows an exception, unwinding all dart frames on the stack. If
3407 /// successful, this function does not return. Note that this means
3408 /// that the destructors of any stack-allocated C++ objects will not be
3409 /// called. If there are no Dart frames on the stack, an error occurs.
3410 ///
3411 /// \return An error handle if the exception was not thrown.
3412 /// Otherwise the function does not return.
3413 pub fn Dart_ReThrowException(exception: Dart_Handle, stacktrace: Dart_Handle) -> Dart_Handle;
3414}
3415extern "C" {
3416 /// Gets the number of native instance fields in an object.
3417 pub fn Dart_GetNativeInstanceFieldCount(obj: Dart_Handle, count: *mut ::core::ffi::c_int) -> Dart_Handle;
3418}
3419extern "C" {
3420 /// Gets the value of a native field.
3421 ///
3422 /// TODO(turnidge): Document.
3423 pub fn Dart_GetNativeInstanceField(obj: Dart_Handle, index: ::core::ffi::c_int, value: *mut isize) -> Dart_Handle;
3424}
3425extern "C" {
3426 /// Sets the value of a native field.
3427 ///
3428 /// TODO(turnidge): Document.
3429 pub fn Dart_SetNativeInstanceField(obj: Dart_Handle, index: ::core::ffi::c_int, value: isize) -> Dart_Handle;
3430}
3431extern "C" {
3432 /// Extracts current isolate group data from the native arguments structure.
3433 pub fn Dart_GetNativeIsolateGroupData(args: Dart_NativeArguments) -> *mut ::core::ffi::c_void;
3434}
3435extern "C" {
3436 /// Gets the native arguments based on the types passed in and populates
3437 /// the passed arguments buffer with appropriate native values.
3438 ///
3439 /// \param args the Native arguments block passed into the native call.
3440 /// \param num_arguments length of argument descriptor array and argument
3441 /// values array passed in.
3442 /// \param arg_descriptors an array that describes the arguments that
3443 /// need to be retrieved. For each argument to be retrieved the descriptor
3444 /// contains the argument number (0, 1 etc.) and the argument type
3445 /// described using Dart_NativeArgument_Type, e.g:
3446 /// DART_NATIVE_ARG_DESCRIPTOR(Dart_NativeArgument_kBool, 1) indicates
3447 /// that the first argument is to be retrieved and it should be a boolean.
3448 /// \param arg_values array into which the native arguments need to be
3449 /// extracted into, the array is allocated by the caller (it could be
3450 /// stack allocated to avoid the malloc/free performance overhead).
3451 ///
3452 /// \return Success if all the arguments could be extracted correctly,
3453 /// returns an error handle if there were any errors while extracting the
3454 /// arguments (mismatched number of arguments, incorrect types, etc.).
3455 pub fn Dart_GetNativeArguments(
3456 args: Dart_NativeArguments, num_arguments: ::core::ffi::c_int,
3457 arg_descriptors: *const Dart_NativeArgument_Descriptor, arg_values: *mut Dart_NativeArgument_Value,
3458 ) -> Dart_Handle;
3459}
3460extern "C" {
3461 /// Gets the native argument at some index.
3462 pub fn Dart_GetNativeArgument(args: Dart_NativeArguments, index: ::core::ffi::c_int) -> Dart_Handle;
3463}
3464extern "C" {
3465 /// Gets the number of native arguments.
3466 pub fn Dart_GetNativeArgumentCount(args: Dart_NativeArguments) -> ::core::ffi::c_int;
3467}
3468extern "C" {
3469 /// Gets all the native fields of the native argument at some index.
3470 /// \param args Native arguments structure.
3471 /// \param arg_index Index of the desired argument in the structure above.
3472 /// \param num_fields size of the intptr_t array 'field_values' passed in.
3473 /// \param field_values intptr_t array in which native field values are returned.
3474 /// \return Success if the native fields where copied in successfully. Otherwise
3475 /// returns an error handle. On success the native field values are copied
3476 /// into the 'field_values' array, if the argument at 'arg_index' is a
3477 /// null object then 0 is copied as the native field values into the
3478 /// 'field_values' array.
3479 pub fn Dart_GetNativeFieldsOfArgument(
3480 args: Dart_NativeArguments, arg_index: ::core::ffi::c_int, num_fields: ::core::ffi::c_int,
3481 field_values: *mut isize,
3482 ) -> Dart_Handle;
3483}
3484extern "C" {
3485 /// Gets the native field of the receiver.
3486 pub fn Dart_GetNativeReceiver(args: Dart_NativeArguments, value: *mut isize) -> Dart_Handle;
3487}
3488extern "C" {
3489 /// Gets a string native argument at some index.
3490 /// \param args Native arguments structure.
3491 /// \param arg_index Index of the desired argument in the structure above.
3492 /// \param peer Returns the peer pointer if the string argument has one.
3493 /// \return Success if the string argument has a peer, if it does not
3494 /// have a peer then the String object is returned. Otherwise returns
3495 /// an error handle (argument is not a String object).
3496 pub fn Dart_GetNativeStringArgument(
3497 args: Dart_NativeArguments, arg_index: ::core::ffi::c_int, peer: *mut *mut ::core::ffi::c_void,
3498 ) -> Dart_Handle;
3499}
3500extern "C" {
3501 /// Gets an integer native argument at some index.
3502 /// \param args Native arguments structure.
3503 /// \param index Index of the desired argument in the structure above.
3504 /// \param value Returns the integer value if the argument is an Integer.
3505 /// \return Success if no error occurs. Otherwise returns an error handle.
3506 pub fn Dart_GetNativeIntegerArgument(
3507 args: Dart_NativeArguments, index: ::core::ffi::c_int, value: *mut i64,
3508 ) -> Dart_Handle;
3509}
3510extern "C" {
3511 /// Gets a boolean native argument at some index.
3512 /// \param args Native arguments structure.
3513 /// \param index Index of the desired argument in the structure above.
3514 /// \param value Returns the boolean value if the argument is a Boolean.
3515 /// \return Success if no error occurs. Otherwise returns an error handle.
3516 pub fn Dart_GetNativeBooleanArgument(
3517 args: Dart_NativeArguments, index: ::core::ffi::c_int, value: *mut bool,
3518 ) -> Dart_Handle;
3519}
3520extern "C" {
3521 /// Gets a double native argument at some index.
3522 /// \param args Native arguments structure.
3523 /// \param index Index of the desired argument in the structure above.
3524 /// \param value Returns the double value if the argument is a double.
3525 /// \return Success if no error occurs. Otherwise returns an error handle.
3526 pub fn Dart_GetNativeDoubleArgument(
3527 args: Dart_NativeArguments, index: ::core::ffi::c_int, value: *mut f64,
3528 ) -> Dart_Handle;
3529}
3530extern "C" {
3531 /// Sets the return value for a native function.
3532 ///
3533 /// If retval is an Error handle, then error will be propagated once
3534 /// the native functions exits. See Dart_PropagateError for a
3535 /// discussion of how different types of errors are propagated.
3536 pub fn Dart_SetReturnValue(args: Dart_NativeArguments, retval: Dart_Handle);
3537}
3538extern "C" {
3539 pub fn Dart_SetWeakHandleReturnValue(args: Dart_NativeArguments, rval: Dart_WeakPersistentHandle);
3540}
3541extern "C" {
3542 pub fn Dart_SetBooleanReturnValue(args: Dart_NativeArguments, retval: bool);
3543}
3544extern "C" {
3545 pub fn Dart_SetIntegerReturnValue(args: Dart_NativeArguments, retval: i64);
3546}
3547extern "C" {
3548 pub fn Dart_SetDoubleReturnValue(args: Dart_NativeArguments, retval: f64);
3549}
3550extern "C" {
3551 /// Sets the environment callback for the current isolate. This
3552 /// callback is used to lookup environment values by name in the
3553 /// current environment. This enables the embedder to supply values for
3554 /// the const constructors bool.fromEnvironment, int.fromEnvironment
3555 /// and String.fromEnvironment.
3556 pub fn Dart_SetEnvironmentCallback(callback: Dart_EnvironmentCallback) -> Dart_Handle;
3557}
3558extern "C" {
3559 /// Sets the callback used to resolve native functions for a library.
3560 ///
3561 /// \param library A library.
3562 /// \param resolver A native entry resolver.
3563 ///
3564 /// \return A valid handle if the native resolver was set successfully.
3565 pub fn Dart_SetNativeResolver(
3566 library: Dart_Handle, resolver: Dart_NativeEntryResolver, symbol: Dart_NativeEntrySymbol,
3567 ) -> Dart_Handle;
3568}
3569extern "C" {
3570 /// Returns the callback used to resolve native functions for a library.
3571 ///
3572 /// \param library A library.
3573 /// \param resolver a pointer to a Dart_NativeEntryResolver
3574 ///
3575 /// \return A valid handle if the library was found.
3576 pub fn Dart_GetNativeResolver(library: Dart_Handle, resolver: *mut Dart_NativeEntryResolver) -> Dart_Handle;
3577}
3578extern "C" {
3579 /// Returns the callback used to resolve native function symbols for a library.
3580 ///
3581 /// \param library A library.
3582 /// \param resolver a pointer to a Dart_NativeEntrySymbol.
3583 ///
3584 /// \return A valid handle if the library was found.
3585 pub fn Dart_GetNativeSymbol(library: Dart_Handle, resolver: *mut Dart_NativeEntrySymbol) -> Dart_Handle;
3586}
3587extern "C" {
3588 /// Sets the callback used to resolve FFI native functions for a library.
3589 /// The resolved functions are expected to be a C function pointer of the
3590 /// correct signature (as specified in the `@FfiNative<NFT>()` function
3591 /// annotation in Dart code).
3592 ///
3593 /// NOTE: This is an experimental feature and might change in the future.
3594 ///
3595 /// \param library A library.
3596 /// \param resolver A native function resolver.
3597 ///
3598 /// \return A valid handle if the native resolver was set successfully.
3599 pub fn Dart_SetFfiNativeResolver(library: Dart_Handle, resolver: Dart_FfiNativeResolver) -> Dart_Handle;
3600}
3601extern "C" {
3602 /// Sets library tag handler for the current isolate. This handler is
3603 /// used to handle the various tags encountered while loading libraries
3604 /// or scripts in the isolate.
3605 ///
3606 /// \param handler Handler code to be used for handling the various tags
3607 /// encountered while loading libraries or scripts in the isolate.
3608 ///
3609 /// \return If no error occurs, the handler is set for the isolate.
3610 /// Otherwise an error handle is returned.
3611 ///
3612 /// TODO(turnidge): Document.
3613 pub fn Dart_SetLibraryTagHandler(handler: Dart_LibraryTagHandler) -> Dart_Handle;
3614}
3615extern "C" {
3616 /// Sets the deferred load handler for the current isolate. This handler is
3617 /// used to handle loading deferred imports in an AppJIT or AppAOT program.
3618 pub fn Dart_SetDeferredLoadHandler(handler: Dart_DeferredLoadHandler) -> Dart_Handle;
3619}
3620extern "C" {
3621 /// Notifies the VM that a deferred load completed successfully. This function
3622 /// will eventually cause the corresponding `prefix.loadLibrary()` futures to
3623 /// complete.
3624 ///
3625 /// Requires the current isolate to be the same current isolate during the
3626 /// invocation of the Dart_DeferredLoadHandler.
3627 pub fn Dart_DeferredLoadComplete(
3628 loading_unit_id: isize, snapshot_data: *const u8, snapshot_instructions: *const u8,
3629 ) -> Dart_Handle;
3630}
3631extern "C" {
3632 /// Notifies the VM that a deferred load failed. This function
3633 /// will eventually cause the corresponding `prefix.loadLibrary()` futures to
3634 /// complete with an error.
3635 ///
3636 /// If `transient` is true, future invocations of `prefix.loadLibrary()` will
3637 /// trigger new load requests. If false, futures invocation will complete with
3638 /// the same error.
3639 ///
3640 /// Requires the current isolate to be the same current isolate during the
3641 /// invocation of the Dart_DeferredLoadHandler.
3642 pub fn Dart_DeferredLoadCompleteError(
3643 loading_unit_id: isize, error_message: *const ::core::ffi::c_char, transient: bool,
3644 ) -> Dart_Handle;
3645}
3646extern "C" {
3647 /// Canonicalizes a url with respect to some library.
3648 ///
3649 /// The url is resolved with respect to the library's url and some url
3650 /// normalizations are performed.
3651 ///
3652 /// This canonicalization function should be sufficient for most
3653 /// embedders to implement the Dart_kCanonicalizeUrl tag.
3654 ///
3655 /// \param base_url The base url relative to which the url is
3656 /// being resolved.
3657 /// \param url The url being resolved and canonicalized. This
3658 /// parameter is a string handle.
3659 ///
3660 /// \return If no error occurs, a String object is returned. Otherwise
3661 /// an error handle is returned.
3662 pub fn Dart_DefaultCanonicalizeUrl(base_url: Dart_Handle, url: Dart_Handle) -> Dart_Handle;
3663}
3664extern "C" {
3665 /// Loads the root library for the current isolate.
3666 ///
3667 /// Requires there to be no current root library.
3668 ///
3669 /// \param kernel_buffer A buffer which contains a kernel binary (see
3670 /// pkg/kernel/binary.md). Must remain valid until isolate group shutdown.
3671 /// \param kernel_size Length of the passed in buffer.
3672 ///
3673 /// \return A handle to the root library, or an error.
3674 pub fn Dart_LoadScriptFromKernel(kernel_buffer: *const u8, kernel_size: isize) -> Dart_Handle;
3675}
3676extern "C" {
3677 /// Gets the library for the root script for the current isolate.
3678 ///
3679 /// If the root script has not yet been set for the current isolate,
3680 /// this function returns Dart_Null(). This function never returns an
3681 /// error handle.
3682 ///
3683 /// \return Returns the root Library for the current isolate or Dart_Null().
3684 pub fn Dart_RootLibrary() -> Dart_Handle;
3685}
3686extern "C" {
3687 /// Sets the root library for the current isolate.
3688 ///
3689 /// \return Returns an error handle if `library` is not a library handle.
3690 pub fn Dart_SetRootLibrary(library: Dart_Handle) -> Dart_Handle;
3691}
3692extern "C" {
3693 /// Lookup or instantiate a legacy type by name and type arguments from a
3694 /// Library.
3695 ///
3696 /// \param library The library containing the class or interface.
3697 /// \param class_name The class name for the type.
3698 /// \param number_of_type_arguments Number of type arguments.
3699 /// For non parametric types the number of type arguments would be 0.
3700 /// \param type_arguments Pointer to an array of type arguments.
3701 /// For non parametric types a NULL would be passed in for this argument.
3702 ///
3703 /// \return If no error occurs, the type is returned.
3704 /// Otherwise an error handle is returned.
3705 pub fn Dart_GetType(
3706 library: Dart_Handle, class_name: Dart_Handle, number_of_type_arguments: isize,
3707 type_arguments: *mut Dart_Handle,
3708 ) -> Dart_Handle;
3709}
3710extern "C" {
3711 /// Lookup or instantiate a nullable type by name and type arguments from
3712 /// Library.
3713 ///
3714 /// \param library The library containing the class or interface.
3715 /// \param class_name The class name for the type.
3716 /// \param number_of_type_arguments Number of type arguments.
3717 /// For non parametric types the number of type arguments would be 0.
3718 /// \param type_arguments Pointer to an array of type arguments.
3719 /// For non parametric types a NULL would be passed in for this argument.
3720 ///
3721 /// \return If no error occurs, the type is returned.
3722 /// Otherwise an error handle is returned.
3723 pub fn Dart_GetNullableType(
3724 library: Dart_Handle, class_name: Dart_Handle, number_of_type_arguments: isize,
3725 type_arguments: *mut Dart_Handle,
3726 ) -> Dart_Handle;
3727}
3728extern "C" {
3729 /// Lookup or instantiate a non-nullable type by name and type arguments from
3730 /// Library.
3731 ///
3732 /// \param library The library containing the class or interface.
3733 /// \param class_name The class name for the type.
3734 /// \param number_of_type_arguments Number of type arguments.
3735 /// For non parametric types the number of type arguments would be 0.
3736 /// \param type_arguments Pointer to an array of type arguments.
3737 /// For non parametric types a NULL would be passed in for this argument.
3738 ///
3739 /// \return If no error occurs, the type is returned.
3740 /// Otherwise an error handle is returned.
3741 pub fn Dart_GetNonNullableType(
3742 library: Dart_Handle, class_name: Dart_Handle, number_of_type_arguments: isize,
3743 type_arguments: *mut Dart_Handle,
3744 ) -> Dart_Handle;
3745}
3746extern "C" {
3747 /// Creates a nullable version of the provided type.
3748 ///
3749 /// \param type The type to be converted to a nullable type.
3750 ///
3751 /// \return If no error occurs, a nullable type is returned.
3752 /// Otherwise an error handle is returned.
3753 pub fn Dart_TypeToNullableType(type_: Dart_Handle) -> Dart_Handle;
3754}
3755extern "C" {
3756 /// Creates a non-nullable version of the provided type.
3757 ///
3758 /// \param type The type to be converted to a non-nullable type.
3759 ///
3760 /// \return If no error occurs, a non-nullable type is returned.
3761 /// Otherwise an error handle is returned.
3762 pub fn Dart_TypeToNonNullableType(type_: Dart_Handle) -> Dart_Handle;
3763}
3764extern "C" {
3765 /// A type's nullability.
3766 ///
3767 /// \param type A Dart type.
3768 /// \param result An out parameter containing the result of the check. True if
3769 /// the type is of the specified nullability, false otherwise.
3770 ///
3771 /// \return Returns an error handle if type is not of type Type.
3772 pub fn Dart_IsNullableType(type_: Dart_Handle, result: *mut bool) -> Dart_Handle;
3773}
3774extern "C" {
3775 pub fn Dart_IsNonNullableType(type_: Dart_Handle, result: *mut bool) -> Dart_Handle;
3776}
3777extern "C" {
3778 pub fn Dart_IsLegacyType(type_: Dart_Handle, result: *mut bool) -> Dart_Handle;
3779}
3780extern "C" {
3781 /// Lookup a class or interface by name from a Library.
3782 ///
3783 /// \param library The library containing the class or interface.
3784 /// \param class_name The name of the class or interface.
3785 ///
3786 /// \return If no error occurs, the class or interface is
3787 /// returned. Otherwise an error handle is returned.
3788 pub fn Dart_GetClass(library: Dart_Handle, class_name: Dart_Handle) -> Dart_Handle;
3789}
3790extern "C" {
3791 /// Returns an import path to a Library, such as "file:///test.dart" or
3792 /// "dart:core".
3793 pub fn Dart_LibraryUrl(library: Dart_Handle) -> Dart_Handle;
3794}
3795extern "C" {
3796 /// Returns a URL from which a Library was loaded.
3797 pub fn Dart_LibraryResolvedUrl(library: Dart_Handle) -> Dart_Handle;
3798}
3799extern "C" {
3800 /// \return An array of libraries.
3801 pub fn Dart_GetLoadedLibraries() -> Dart_Handle;
3802}
3803extern "C" {
3804 pub fn Dart_LookupLibrary(url: Dart_Handle) -> Dart_Handle;
3805}
3806extern "C" {
3807 /// Report an loading error for the library.
3808 ///
3809 /// \param library The library that failed to load.
3810 /// \param error The Dart error instance containing the load error.
3811 ///
3812 /// \return If the VM handles the error, the return value is
3813 /// a null handle. If it doesn't handle the error, the error
3814 /// object is returned.
3815 pub fn Dart_LibraryHandleError(library: Dart_Handle, error: Dart_Handle) -> Dart_Handle;
3816}
3817extern "C" {
3818 /// Called by the embedder to load a partial program. Does not set the root
3819 /// library.
3820 ///
3821 /// \param kernel_buffer A buffer which contains a kernel binary (see
3822 /// pkg/kernel/binary.md). Must remain valid until isolate shutdown.
3823 /// \param kernel_buffer_size Length of the passed in buffer.
3824 ///
3825 /// \return A handle to the main library of the compilation unit, or an error.
3826 pub fn Dart_LoadLibraryFromKernel(kernel_buffer: *const u8, kernel_buffer_size: isize) -> Dart_Handle;
3827}
3828extern "C" {
3829 pub fn Dart_LoadLibrary(kernel_buffer: Dart_Handle) -> Dart_Handle;
3830}
3831extern "C" {
3832 /// Indicates that all outstanding load requests have been satisfied.
3833 /// This finalizes all the new classes loaded and optionally completes
3834 /// deferred library futures.
3835 ///
3836 /// Requires there to be a current isolate.
3837 ///
3838 /// \param complete_futures Specify true if all deferred library
3839 /// futures should be completed, false otherwise.
3840 ///
3841 /// \return Success if all classes have been finalized and deferred library
3842 /// futures are completed. Otherwise, returns an error.
3843 pub fn Dart_FinalizeLoading(complete_futures: bool) -> Dart_Handle;
3844}
3845extern "C" {
3846 /// Returns the value of peer field of 'object' in 'peer'.
3847 ///
3848 /// \param object An object.
3849 /// \param peer An out parameter that returns the value of the peer
3850 /// field.
3851 ///
3852 /// \return Returns an error if 'object' is a subtype of Null, num, or
3853 /// bool.
3854 pub fn Dart_GetPeer(object: Dart_Handle, peer: *mut *mut ::core::ffi::c_void) -> Dart_Handle;
3855}
3856extern "C" {
3857 /// Sets the value of the peer field of 'object' to the value of
3858 /// 'peer'.
3859 ///
3860 /// \param object An object.
3861 /// \param peer A value to store in the peer field.
3862 ///
3863 /// \return Returns an error if 'object' is a subtype of Null, num, or
3864 /// bool.
3865 pub fn Dart_SetPeer(object: Dart_Handle, peer: *mut ::core::ffi::c_void) -> Dart_Handle;
3866}
3867extern "C" {
3868 pub fn Dart_IsKernelIsolate(isolate: Dart_Isolate) -> bool;
3869}
3870extern "C" {
3871 pub fn Dart_KernelIsolateIsRunning() -> bool;
3872}
3873extern "C" {
3874 pub fn Dart_KernelPort() -> Dart_Port;
3875}
3876extern "C" {
3877 /// Compiles the given `script_uri` to a kernel file.
3878 ///
3879 /// \param platform_kernel A buffer containing the kernel of the platform (e.g.
3880 /// `vm_platform_strong.dill`). The VM does not take ownership of this memory.
3881 ///
3882 /// \param platform_kernel_size The length of the platform_kernel buffer.
3883 ///
3884 /// \param snapshot_compile Set to `true` when the compilation is for a snapshot.
3885 /// This is used by the frontend to determine if compilation related information
3886 /// should be printed to console (e.g., null safety mode).
3887 ///
3888 /// \param embed_sources Set to `true` when sources should be embedded in the
3889 /// kernel file.
3890 ///
3891 /// \param verbosity Specifies the logging behavior of the kernel compilation
3892 /// service.
3893 ///
3894 /// \return Returns the result of the compilation.
3895 ///
3896 /// On a successful compilation the returned [Dart_KernelCompilationResult] has
3897 /// a status of [Dart_KernelCompilationStatus_Ok] and the `kernel`/`kernel_size`
3898 /// fields are set. The caller takes ownership of the malloc()ed buffer.
3899 ///
3900 /// On a failed compilation the `error` might be set describing the reason for
3901 /// the failed compilation. The caller takes ownership of the malloc()ed
3902 /// error.
3903 ///
3904 /// Requires there to be a current isolate.
3905 pub fn Dart_CompileToKernel(
3906 script_uri: *const ::core::ffi::c_char, platform_kernel: *const u8, platform_kernel_size: isize,
3907 incremental_compile: bool, snapshot_compile: bool, embed_sources: bool,
3908 package_config: *const ::core::ffi::c_char, verbosity: Dart_KernelCompilationVerbosityLevel,
3909 ) -> Dart_KernelCompilationResult;
3910}
3911extern "C" {
3912 pub fn Dart_KernelListDependencies() -> Dart_KernelCompilationResult;
3913}
3914extern "C" {
3915 /// Sets the kernel buffer which will be used to load Dart SDK sources
3916 /// dynamically at runtime.
3917 ///
3918 /// \param platform_kernel A buffer containing kernel which has sources for the
3919 /// Dart SDK populated. Note: The VM does not take ownership of this memory.
3920 ///
3921 /// \param platform_kernel_size The length of the platform_kernel buffer.
3922 pub fn Dart_SetDartLibrarySourcesKernel(platform_kernel: *const u8, platform_kernel_size: isize);
3923}
3924extern "C" {
3925 /// Detect the null safety opt-in status.
3926 ///
3927 /// When running from source, it is based on the opt-in status of `script_uri`.
3928 /// When running from a kernel buffer, it is based on the mode used when
3929 /// generating `kernel_buffer`.
3930 /// When running from an appJIT or AOT snapshot, it is based on the mode used
3931 /// when generating `snapshot_data`.
3932 ///
3933 /// \param script_uri Uri of the script that contains the source code
3934 ///
3935 /// \param package_config Uri of the package configuration file (either in format
3936 /// of .packages or .dart_tool/package_config.json) for the null safety
3937 /// detection to resolve package imports against. If this parameter is not
3938 /// passed the package resolution of the parent isolate should be used.
3939 ///
3940 /// \param original_working_directory current working directory when the VM
3941 /// process was launched, this is used to correctly resolve the path specified
3942 /// for package_config.
3943 ///
3944 /// \param snapshot_data Buffer containing the snapshot data of the
3945 /// isolate or NULL if no snapshot is provided. If provided, the buffers must
3946 /// remain valid until the isolate shuts down.
3947 ///
3948 /// \param snapshot_instructions Buffer containing the snapshot instructions of
3949 /// the isolate or NULL if no snapshot is provided. If provided, the buffers
3950 /// must remain valid until the isolate shuts down.
3951 ///
3952 /// \param kernel_buffer A buffer which contains a kernel/DIL program. Must
3953 /// remain valid until isolate shutdown.
3954 ///
3955 /// \param kernel_buffer_size The size of `kernel_buffer`.
3956 ///
3957 /// \return Returns true if the null safety is opted in by the input being
3958 /// run `script_uri`, `snapshot_data` or `kernel_buffer`.
3959 pub fn Dart_DetectNullSafety(
3960 script_uri: *const ::core::ffi::c_char, package_config: *const ::core::ffi::c_char,
3961 original_working_directory: *const ::core::ffi::c_char, snapshot_data: *const u8,
3962 snapshot_instructions: *const u8, kernel_buffer: *const u8, kernel_buffer_size: isize,
3963 ) -> bool;
3964}
3965extern "C" {
3966 /// Returns true if isolate is the service isolate.
3967 ///
3968 /// \param isolate An isolate
3969 ///
3970 /// \return Returns true if 'isolate' is the service isolate.
3971 pub fn Dart_IsServiceIsolate(isolate: Dart_Isolate) -> bool;
3972}
3973extern "C" {
3974 /// Writes the CPU profile to the timeline as a series of 'instant' events.
3975 ///
3976 /// Note that this is an expensive operation.
3977 ///
3978 /// \param main_port The main port of the Isolate whose profile samples to write.
3979 /// \param error An optional error, must be free()ed by caller.
3980 ///
3981 /// \return Returns true if the profile is successfully written and false
3982 /// otherwise.
3983 pub fn Dart_WriteProfileToTimeline(main_port: Dart_Port, error: *mut *mut ::core::ffi::c_char) -> bool;
3984}
3985extern "C" {
3986 /// Compiles all functions reachable from entry points and marks
3987 /// the isolate to disallow future compilation.
3988 ///
3989 /// Entry points should be specified using `@pragma("vm:entry-point")`
3990 /// annotation.
3991 ///
3992 /// \return An error handle if a compilation error or runtime error running const
3993 /// constructors was encountered.
3994 pub fn Dart_Precompile() -> Dart_Handle;
3995}
3996extern "C" {
3997 pub fn Dart_LoadingUnitLibraryUris(loading_unit_id: isize) -> Dart_Handle;
3998}
3999extern "C" {
4000 /// Creates a precompiled snapshot.
4001 /// - A root library must have been loaded.
4002 /// - Dart_Precompile must have been called.
4003 ///
4004 /// Outputs an assembly file defining the symbols listed in the definitions
4005 /// above.
4006 ///
4007 /// The assembly should be compiled as a static or shared library and linked or
4008 /// loaded by the embedder. Running this snapshot requires a VM compiled with
4009 /// DART_PRECOMPILED_SNAPSHOT. The kDartVmSnapshotData and
4010 /// kDartVmSnapshotInstructions should be passed to Dart_Initialize. The
4011 /// kDartIsolateSnapshotData and kDartIsolateSnapshotInstructions should be
4012 /// passed to Dart_CreateIsolateGroup.
4013 ///
4014 /// The callback will be invoked one or more times to provide the assembly code.
4015 ///
4016 /// If stripped is true, then the assembly code will not include DWARF
4017 /// debugging sections.
4018 ///
4019 /// If debug_callback_data is provided, debug_callback_data will be used with
4020 /// the callback to provide separate debugging information.
4021 ///
4022 /// \return A valid handle if no error occurs during the operation.
4023 pub fn Dart_CreateAppAOTSnapshotAsAssembly(
4024 callback: Dart_StreamingWriteCallback, callback_data: *mut ::core::ffi::c_void, stripped: bool,
4025 debug_callback_data: *mut ::core::ffi::c_void,
4026 ) -> Dart_Handle;
4027}
4028extern "C" {
4029 pub fn Dart_CreateAppAOTSnapshotAsAssemblies(
4030 next_callback: Dart_CreateLoadingUnitCallback, next_callback_data: *mut ::core::ffi::c_void, stripped: bool,
4031 write_callback: Dart_StreamingWriteCallback, close_callback: Dart_StreamingCloseCallback,
4032 ) -> Dart_Handle;
4033}
4034extern "C" {
4035 /// Creates a precompiled snapshot.
4036 /// - A root library must have been loaded.
4037 /// - Dart_Precompile must have been called.
4038 ///
4039 /// Outputs an ELF shared library defining the symbols
4040 /// - _kDartVmSnapshotData
4041 /// - _kDartVmSnapshotInstructions
4042 /// - _kDartIsolateSnapshotData
4043 /// - _kDartIsolateSnapshotInstructions
4044 ///
4045 /// The shared library should be dynamically loaded by the embedder.
4046 /// Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT.
4047 /// The kDartVmSnapshotData and kDartVmSnapshotInstructions should be passed to
4048 /// Dart_Initialize. The kDartIsolateSnapshotData and
4049 /// kDartIsolateSnapshotInstructions should be passed to Dart_CreateIsolate.
4050 ///
4051 /// The callback will be invoked one or more times to provide the binary output.
4052 ///
4053 /// If stripped is true, then the binary output will not include DWARF
4054 /// debugging sections.
4055 ///
4056 /// If debug_callback_data is provided, debug_callback_data will be used with
4057 /// the callback to provide separate debugging information.
4058 ///
4059 /// \return A valid handle if no error occurs during the operation.
4060 pub fn Dart_CreateAppAOTSnapshotAsElf(
4061 callback: Dart_StreamingWriteCallback, callback_data: *mut ::core::ffi::c_void, stripped: bool,
4062 debug_callback_data: *mut ::core::ffi::c_void,
4063 ) -> Dart_Handle;
4064}
4065extern "C" {
4066 pub fn Dart_CreateAppAOTSnapshotAsElfs(
4067 next_callback: Dart_CreateLoadingUnitCallback, next_callback_data: *mut ::core::ffi::c_void, stripped: bool,
4068 write_callback: Dart_StreamingWriteCallback, close_callback: Dart_StreamingCloseCallback,
4069 ) -> Dart_Handle;
4070}
4071extern "C" {
4072 /// Like Dart_CreateAppAOTSnapshotAsAssembly, but only includes
4073 /// kDartVmSnapshotData and kDartVmSnapshotInstructions. It also does
4074 /// not strip DWARF information from the generated assembly or allow for
4075 /// separate debug information.
4076 pub fn Dart_CreateVMAOTSnapshotAsAssembly(
4077 callback: Dart_StreamingWriteCallback, callback_data: *mut ::core::ffi::c_void,
4078 ) -> Dart_Handle;
4079}
4080extern "C" {
4081 /// Sorts the class-ids in depth first traversal order of the inheritance
4082 /// tree. This is a costly operation, but it can make method dispatch
4083 /// more efficient and is done before writing snapshots.
4084 ///
4085 /// \return A valid handle if no error occurs during the operation.
4086 pub fn Dart_SortClasses() -> Dart_Handle;
4087}
4088extern "C" {
4089 /// Creates a snapshot that caches compiled code and type feedback for faster
4090 /// startup and quicker warmup in a subsequent process.
4091 ///
4092 /// Outputs a snapshot in two pieces. The pieces should be passed to
4093 /// Dart_CreateIsolateGroup in a VM using the same VM snapshot pieces used in the
4094 /// current VM. The instructions piece must be loaded with read and execute
4095 /// permissions; the data piece may be loaded as read-only.
4096 ///
4097 /// - Requires the VM to have not been started with --precompilation.
4098 /// - Not supported when targeting IA32.
4099 /// - The VM writing the snapshot and the VM reading the snapshot must be the same version,
4100 /// must be built in the same DEBUG/RELEASE/PRODUCT mode, must be targeting the same
4101 /// architecture, and must both be in checked mode or both in unchecked mode.
4102 ///
4103 /// The buffers are scope allocated and are only valid until the next call to
4104 /// Dart_ExitScope.
4105 ///
4106 /// \return A valid handle if no error occurs during the operation.
4107 pub fn Dart_CreateAppJITSnapshotAsBlobs(
4108 isolate_snapshot_data_buffer: *mut *mut u8, isolate_snapshot_data_size: *mut isize,
4109 isolate_snapshot_instructions_buffer: *mut *mut u8, isolate_snapshot_instructions_size: *mut isize,
4110 ) -> Dart_Handle;
4111}
4112extern "C" {
4113 /// Like Dart_CreateAppJITSnapshotAsBlobs, but also creates a new VM snapshot.
4114 pub fn Dart_CreateCoreJITSnapshotAsBlobs(
4115 vm_snapshot_data_buffer: *mut *mut u8, vm_snapshot_data_size: *mut isize,
4116 vm_snapshot_instructions_buffer: *mut *mut u8, vm_snapshot_instructions_size: *mut isize,
4117 isolate_snapshot_data_buffer: *mut *mut u8, isolate_snapshot_data_size: *mut isize,
4118 isolate_snapshot_instructions_buffer: *mut *mut u8, isolate_snapshot_instructions_size: *mut isize,
4119 ) -> Dart_Handle;
4120}
4121extern "C" {
4122 /// Get obfuscation map for precompiled code.
4123 ///
4124 /// Obfuscation map is encoded as a JSON array of pairs (original name,
4125 /// obfuscated name).
4126 ///
4127 /// \return Returns an error handler if the VM was built in a mode that does not
4128 /// support obfuscation.
4129 pub fn Dart_GetObfuscationMap(buffer: *mut *mut u8, buffer_length: *mut isize) -> Dart_Handle;
4130}
4131extern "C" {
4132 /// Returns whether the VM only supports running from precompiled snapshots and
4133 /// not from any other kind of snapshot or from source (that is, the VM was
4134 /// compiled with DART_PRECOMPILED_RUNTIME).
4135 pub fn Dart_IsPrecompiledRuntime() -> bool;
4136}
4137extern "C" {
4138 /// Print a native stack trace. Used for crash handling.
4139 ///
4140 /// If context is NULL, prints the current stack trace. Otherwise, context
4141 /// should be a CONTEXT* (Windows) or ucontext_t* (POSIX) from a signal handler
4142 /// running on the current thread.
4143 pub fn Dart_DumpNativeStackTrace(context: *mut ::core::ffi::c_void);
4144}
4145extern "C" {
4146 /// Indicate that the process is about to abort, and the Dart VM should not
4147 /// attempt to cleanup resources.
4148 pub fn Dart_PrepareToAbort();
4149}
4150extern "C" {
4151 /// Configure DWARF stack trace footnote callback.
4152 pub fn Dart_SetDwarfStackTraceFootnoteCallback(callback: Dart_DwarfStackTraceFootnoteCallback);
4153}
4154extern "C" {
4155 /// Posts a message on some port. The message will contain the Dart_CObject
4156 /// object graph rooted in 'message'.
4157 ///
4158 /// While the message is being sent the state of the graph of Dart_CObject
4159 /// structures rooted in 'message' should not be accessed, as the message
4160 /// generation will make temporary modifications to the data. When the message
4161 /// has been sent the graph will be fully restored.
4162 ///
4163 /// If true is returned, the message was enqueued, and finalizers for external
4164 /// typed data will eventually run, even if the receiving isolate shuts down
4165 /// before processing the message. If false is returned, the message was not
4166 /// enqueued and ownership of external typed data in the message remains with the
4167 /// caller.
4168 ///
4169 /// This function may be called on any thread when the VM is running (that is,
4170 /// after Dart_Initialize has returned and before Dart_Cleanup has been called).
4171 ///
4172 /// \param port_id The destination port.
4173 /// \param message The message to send.
4174 ///
4175 /// \return True if the message was posted.
4176 pub fn Dart_PostCObject(port_id: Dart_Port, message: *mut Dart_CObject) -> bool;
4177}
4178extern "C" {
4179 /// Posts a message on some port. The message will contain the integer 'message'.
4180 ///
4181 /// \param port_id The destination port.
4182 /// \param message The message to send.
4183 ///
4184 /// \return True if the message was posted.
4185 pub fn Dart_PostInteger(port_id: Dart_Port, message: i64) -> bool;
4186}
4187extern "C" {
4188 /// Creates a new native port. When messages are received on this
4189 /// native port, then they will be dispatched to the provided native
4190 /// message handler.
4191 ///
4192 /// \param name The name of this port in debugging messages.
4193 /// \param handler The C handler to run when messages arrive on the port.
4194 /// \param handle_concurrently Is it okay to process requests on this
4195 /// native port concurrently?
4196 ///
4197 /// \return If successful, returns the port id for the native port. In
4198 /// case of error, returns ILLEGAL_PORT.
4199 pub fn Dart_NewNativePort(
4200 name: *const ::core::ffi::c_char, handler: Dart_NativeMessageHandler, handle_concurrently: bool,
4201 ) -> Dart_Port;
4202}
4203extern "C" {
4204 /// Closes the native port with the given id.
4205 ///
4206 /// The port must have been allocated by a call to Dart_NewNativePort.
4207 ///
4208 /// \param native_port_id The id of the native port to close.
4209 ///
4210 /// \return Returns true if the port was closed successfully.
4211 pub fn Dart_CloseNativePort(native_port_id: Dart_Port) -> bool;
4212}
4213extern "C" {
4214 /// Forces all loaded classes and functions to be compiled eagerly in
4215 /// the current isolate..
4216 ///
4217 /// TODO(turnidge): Document.
4218 pub fn Dart_CompileAll() -> Dart_Handle;
4219}
4220extern "C" {
4221 /// Finalizes all classes.
4222 pub fn Dart_FinalizeAllClasses() -> Dart_Handle;
4223}
4224extern "C" {
4225 pub fn Dart_ExecuteInternalCommand(
4226 command: *const ::core::ffi::c_char, arg: *mut ::core::ffi::c_void,
4227 ) -> *mut ::core::ffi::c_void;
4228}
4229extern "C" {
4230 /// \mainpage Dynamically Linked Dart API
4231 ///
4232 /// This exposes a subset of symbols from dart_api.h and dart_native_api.h
4233 /// available in every Dart embedder through dynamic linking.
4234 ///
4235 /// All symbols are postfixed with _DL to indicate that they are dynamically
4236 /// linked and to prevent conflicts with the original symbol.
4237 ///
4238 /// Link `dart_api_dl.c` file into your library and invoke
4239 /// `Dart_InitializeApiDL` with `NativeApi.initializeApiDLData`.
4240 pub fn Dart_InitializeApiDL(data: *mut ::core::ffi::c_void) -> isize;
4241}
4242extern "C" {
4243 pub static mut Dart_PostCObject_DL: Dart_PostCObject_Type;
4244}
4245extern "C" {
4246 pub static mut Dart_PostInteger_DL: Dart_PostInteger_Type;
4247}
4248extern "C" {
4249 pub static mut Dart_NewNativePort_DL: Dart_NewNativePort_Type;
4250}
4251extern "C" {
4252 pub static mut Dart_CloseNativePort_DL: Dart_CloseNativePort_Type;
4253}
4254extern "C" {
4255 pub static mut Dart_IsError_DL: Dart_IsError_Type;
4256}
4257extern "C" {
4258 pub static mut Dart_IsApiError_DL: Dart_IsApiError_Type;
4259}
4260extern "C" {
4261 pub static mut Dart_IsUnhandledExceptionError_DL: Dart_IsUnhandledExceptionError_Type;
4262}
4263extern "C" {
4264 pub static mut Dart_IsCompilationError_DL: Dart_IsCompilationError_Type;
4265}
4266extern "C" {
4267 pub static mut Dart_IsFatalError_DL: Dart_IsFatalError_Type;
4268}
4269extern "C" {
4270 pub static mut Dart_GetError_DL: Dart_GetError_Type;
4271}
4272extern "C" {
4273 pub static mut Dart_ErrorHasException_DL: Dart_ErrorHasException_Type;
4274}
4275extern "C" {
4276 pub static mut Dart_ErrorGetException_DL: Dart_ErrorGetException_Type;
4277}
4278extern "C" {
4279 pub static mut Dart_ErrorGetStackTrace_DL: Dart_ErrorGetStackTrace_Type;
4280}
4281extern "C" {
4282 pub static mut Dart_NewApiError_DL: Dart_NewApiError_Type;
4283}
4284extern "C" {
4285 pub static mut Dart_NewCompilationError_DL: Dart_NewCompilationError_Type;
4286}
4287extern "C" {
4288 pub static mut Dart_NewUnhandledExceptionError_DL: Dart_NewUnhandledExceptionError_Type;
4289}
4290extern "C" {
4291 pub static mut Dart_PropagateError_DL: Dart_PropagateError_Type;
4292}
4293extern "C" {
4294 pub static mut Dart_HandleFromPersistent_DL: Dart_HandleFromPersistent_Type;
4295}
4296extern "C" {
4297 pub static mut Dart_HandleFromWeakPersistent_DL: Dart_HandleFromWeakPersistent_Type;
4298}
4299extern "C" {
4300 pub static mut Dart_NewPersistentHandle_DL: Dart_NewPersistentHandle_Type;
4301}
4302extern "C" {
4303 pub static mut Dart_SetPersistentHandle_DL: Dart_SetPersistentHandle_Type;
4304}
4305extern "C" {
4306 pub static mut Dart_DeletePersistentHandle_DL: Dart_DeletePersistentHandle_Type;
4307}
4308extern "C" {
4309 pub static mut Dart_NewWeakPersistentHandle_DL: Dart_NewWeakPersistentHandle_Type;
4310}
4311extern "C" {
4312 pub static mut Dart_DeleteWeakPersistentHandle_DL: Dart_DeleteWeakPersistentHandle_Type;
4313}
4314extern "C" {
4315 pub static mut Dart_NewFinalizableHandle_DL: Dart_NewFinalizableHandle_Type;
4316}
4317extern "C" {
4318 pub static mut Dart_DeleteFinalizableHandle_DL: Dart_DeleteFinalizableHandle_Type;
4319}
4320extern "C" {
4321 pub static mut Dart_CurrentIsolate_DL: Dart_CurrentIsolate_Type;
4322}
4323extern "C" {
4324 pub static mut Dart_ExitIsolate_DL: Dart_ExitIsolate_Type;
4325}
4326extern "C" {
4327 pub static mut Dart_EnterIsolate_DL: Dart_EnterIsolate_Type;
4328}
4329extern "C" {
4330 pub static mut Dart_Post_DL: Dart_Post_Type;
4331}
4332extern "C" {
4333 pub static mut Dart_NewSendPort_DL: Dart_NewSendPort_Type;
4334}
4335extern "C" {
4336 pub static mut Dart_SendPortGetId_DL: Dart_SendPortGetId_Type;
4337}
4338extern "C" {
4339 pub static mut Dart_EnterScope_DL: Dart_EnterScope_Type;
4340}
4341extern "C" {
4342 pub static mut Dart_ExitScope_DL: Dart_ExitScope_Type;
4343}
4344extern "C" {
4345 pub static mut Dart_IsNull_DL: Dart_IsNull_Type;
4346}
4347extern "C" {
4348 pub static mut Dart_UpdateExternalSize_DL: Dart_UpdateExternalSize_Type;
4349}
4350extern "C" {
4351 pub static mut Dart_UpdateFinalizableExternalSize_DL: Dart_UpdateFinalizableExternalSize_Type;
4352}
4353extern "C" {
4354 /// Register a Dart_ServiceRequestCallback to be called to handle
4355 /// requests for the named rpc on a specific isolate. The callback will
4356 /// be invoked with the current isolate set to the request target.
4357 ///
4358 /// \param method The name of the method that this callback is responsible for.
4359 /// \param callback The callback to invoke.
4360 /// \param user_data The user data passed to the callback.
4361 ///
4362 /// NOTE: If multiple callbacks with the same name are registered, only
4363 /// the last callback registered will be remembered.
4364 pub fn Dart_RegisterIsolateServiceRequestCallback(
4365 method: *const ::core::ffi::c_char, callback: Dart_ServiceRequestCallback, user_data: *mut ::core::ffi::c_void,
4366 );
4367}
4368extern "C" {
4369 /// Register a Dart_ServiceRequestCallback to be called to handle
4370 /// requests for the named rpc. The callback will be invoked without a
4371 /// current isolate.
4372 ///
4373 /// \param method The name of the command that this callback is responsible for.
4374 /// \param callback The callback to invoke.
4375 /// \param user_data The user data passed to the callback.
4376 ///
4377 /// NOTE: If multiple callbacks with the same name are registered, only
4378 /// the last callback registered will be remembered.
4379 pub fn Dart_RegisterRootServiceRequestCallback(
4380 method: *const ::core::ffi::c_char, callback: Dart_ServiceRequestCallback, user_data: *mut ::core::ffi::c_void,
4381 );
4382}
4383extern "C" {
4384 /// Register a Dart_ServiceRequestCallback to be called to handle
4385 /// requests for the named rpc. The callback will be invoked without a
4386 /// current isolate.
4387 ///
4388 /// \param method The name of the command that this callback is responsible for.
4389 /// \param callback The callback to invoke.
4390 /// \param user_data The user data passed to the callback.
4391 ///
4392 /// NOTE: If multiple callbacks are registered, only the last callback registered
4393 /// will be remembered.
4394 pub fn Dart_SetEmbedderInformationCallback(callback: Dart_EmbedderInformationCallback);
4395}
4396extern "C" {
4397 /// Invoke a vm-service method and wait for its result.
4398 ///
4399 /// \param request_json The utf8-encoded json-rpc request.
4400 /// \param request_json_length The length of the json-rpc request.
4401 ///
4402 /// \param response_json The returned utf8-encoded json response, must be
4403 /// free()ed by caller.
4404 /// \param response_json_length The length of the returned json response.
4405 /// \param error An optional error, must be free()ed by caller.
4406 ///
4407 /// \return Whether the call was successfully performed.
4408 ///
4409 /// NOTE: This method does not need a current isolate and must not have the
4410 /// vm-isolate being the current isolate. It must be called after
4411 /// Dart_Initialize() and before Dart_Cleanup().
4412 pub fn Dart_InvokeVMServiceMethod(
4413 request_json: *mut u8, request_json_length: isize, response_json: *mut *mut u8,
4414 response_json_length: *mut isize, error: *mut *mut ::core::ffi::c_char,
4415 ) -> bool;
4416}
4417extern "C" {
4418 /// Adds VM service stream callbacks.
4419 ///
4420 /// \param listen_callback A function pointer to a listen callback function.
4421 /// A listen callback function should not be already set when this function
4422 /// is called. A NULL value removes the existing listen callback function
4423 /// if any.
4424 ///
4425 /// \param cancel_callback A function pointer to a cancel callback function.
4426 /// A cancel callback function should not be already set when this function
4427 /// is called. A NULL value removes the existing cancel callback function
4428 /// if any.
4429 ///
4430 /// \return Success if the callbacks were added. Otherwise, returns an
4431 /// error handle.
4432 pub fn Dart_SetServiceStreamCallbacks(
4433 listen_callback: Dart_ServiceStreamListenCallback, cancel_callback: Dart_ServiceStreamCancelCallback,
4434 ) -> *mut ::core::ffi::c_char;
4435}
4436extern "C" {
4437 /// Sends a data event to clients of the VM Service.
4438 ///
4439 /// A data event is used to pass an array of bytes to subscribed VM
4440 /// Service clients. For example, in the standalone embedder, this is
4441 /// function used to provide WriteEvents on the Stdout and Stderr
4442 /// streams.
4443 ///
4444 /// If the embedder passes in a stream id for which no client is
4445 /// subscribed, then the event is ignored.
4446 ///
4447 /// \param stream_id The id of the stream on which to post the event.
4448 ///
4449 /// \param event_kind A string identifying what kind of event this is.
4450 /// For example, 'WriteEvent'.
4451 ///
4452 /// \param bytes A pointer to an array of bytes.
4453 ///
4454 /// \param bytes_length The length of the byte array.
4455 ///
4456 /// \return NULL if the arguments are well formed. Otherwise, returns an
4457 /// error string. The caller is responsible for freeing the error message.
4458 pub fn Dart_ServiceSendDataEvent(
4459 stream_id: *const ::core::ffi::c_char, event_kind: *const ::core::ffi::c_char, bytes: *const u8,
4460 bytes_length: isize,
4461 ) -> *mut ::core::ffi::c_char;
4462}
4463extern "C" {
4464 pub fn Dart_SetFileModifiedCallback(file_modified_callback: Dart_FileModifiedCallback) -> *mut ::core::ffi::c_char;
4465}
4466extern "C" {
4467 /// Returns true if isolate is currently reloading.
4468 pub fn Dart_IsReloading() -> bool;
4469}
4470extern "C" {
4471 /// Enable tracking of specified timeline category. This is operational
4472 /// only when systrace timeline functionality is turned on.
4473 ///
4474 /// \param categories A comma separated list of categories that need to
4475 /// be enabled, the categories are
4476 /// "all" : All categories
4477 /// "API" - Execution of Dart C API functions
4478 /// "Compiler" - Execution of Dart JIT compiler
4479 /// "CompilerVerbose" - More detailed Execution of Dart JIT compiler
4480 /// "Dart" - Execution of Dart code
4481 /// "Debugger" - Execution of Dart debugger
4482 /// "Embedder" - Execution of Dart embedder code
4483 /// "GC" - Execution of Dart Garbage Collector
4484 /// "Isolate" - Dart Isolate lifecycle execution
4485 /// "VM" - Execution in Dart VM runtime code
4486 /// "" - None
4487 ///
4488 /// When "all" is specified all the categories are enabled.
4489 /// When a comma separated list of categories is specified, the categories
4490 /// that are specified will be enabled and the rest will be disabled.
4491 /// When "" is specified all the categories are disabled.
4492 /// The category names are case sensitive.
4493 /// eg: Dart_EnableTimelineCategory("all");
4494 /// Dart_EnableTimelineCategory("GC,API,Isolate");
4495 /// Dart_EnableTimelineCategory("GC,Debugger,Dart");
4496 ///
4497 /// \return True if the categories were successfully enabled, False otherwise.
4498 pub fn Dart_SetEnabledTimelineCategory(categories: *const ::core::ffi::c_char) -> bool;
4499}
4500extern "C" {
4501 /// Returns a timestamp in microseconds. This timestamp is suitable for
4502 /// passing into the timeline system, and uses the same monotonic clock
4503 /// as dart:developer's Timeline.now.
4504 ///
4505 /// \return A timestamp that can be passed to the timeline system.
4506 pub fn Dart_TimelineGetMicros() -> i64;
4507}
4508extern "C" {
4509 /// Returns a raw timestamp in from the monotonic clock.
4510 ///
4511 /// \return A raw timestamp from the monotonic clock.
4512 pub fn Dart_TimelineGetTicks() -> i64;
4513}
4514extern "C" {
4515 /// Returns the frequency of the monotonic clock.
4516 ///
4517 /// \return The frequency of the monotonic clock.
4518 pub fn Dart_TimelineGetTicksFrequency() -> i64;
4519}
4520extern "C" {
4521 /// Add a timeline event to the embedder stream.
4522 ///
4523 /// DEPRECATED: this function will be removed in Dart SDK v3.2.
4524 ///
4525 /// \param label The name of the event. Its lifetime must extend at least until
4526 /// Dart_Cleanup.
4527 /// \param timestamp0 The first timestamp of the event.
4528 /// \param timestamp1_or_id When reporting an event of type
4529 /// |Dart_Timeline_Event_Duration|, the second (end) timestamp of the event
4530 /// should be passed through |timestamp1_or_id|. When reporting an event of
4531 /// type |Dart_Timeline_Event_Async_Begin|, |Dart_Timeline_Event_Async_End|,
4532 /// or |Dart_Timeline_Event_Async_Instant|, the async ID associated with the
4533 /// event should be passed through |timestamp1_or_id|. When reporting an
4534 /// event of type |Dart_Timeline_Event_Flow_Begin|,
4535 /// |Dart_Timeline_Event_Flow_Step|, or |Dart_Timeline_Event_Flow_End|, the
4536 /// flow ID associated with the event should be passed through
4537 /// |timestamp1_or_id|. When reporting an event of type
4538 /// |Dart_Timeline_Event_Begin| or |Dart_Timeline_Event_End|, the event ID
4539 /// associated with the event should be passed through |timestamp1_or_id|.
4540 /// Note that this event ID will only be used by the MacOS recorder. The
4541 /// argument to |timestamp1_or_id| will not be used when reporting events of
4542 /// other types.
4543 /// \param argument_count The number of argument names and values.
4544 /// \param argument_names An array of names of the arguments. The lifetime of the
4545 /// names must extend at least until Dart_Cleanup. The array may be reclaimed
4546 /// when this call returns.
4547 /// \param argument_values An array of values of the arguments. The values and
4548 /// the array may be reclaimed when this call returns.
4549 pub fn Dart_TimelineEvent(
4550 label: *const ::core::ffi::c_char, timestamp0: i64, timestamp1_or_id: i64, type_: Dart_Timeline_Event_Type,
4551 argument_count: isize, argument_names: *mut *const ::core::ffi::c_char,
4552 argument_values: *mut *const ::core::ffi::c_char,
4553 );
4554}
4555extern "C" {
4556 /// Add a timeline event to the embedder stream.
4557 ///
4558 /// Note regarding flow events: events must be associated with flow IDs in two
4559 /// different ways to allow flow events to be serialized correctly in both
4560 /// Chrome's JSON trace event format and Perfetto's proto trace format. Events
4561 /// of type |Dart_Timeline_Event_Flow_Begin|, |Dart_Timeline_Event_Flow_Step|,
4562 /// and |Dart_Timeline_Event_Flow_End| must be reported to support serialization
4563 /// in Chrome's trace format. The |flow_ids| argument must be supplied when
4564 /// reporting events of type |Dart_Timeline_Event_Begin|,
4565 /// |Dart_Timeline_Event_Duration|, |Dart_Timeline_Event_Instant|,
4566 /// |Dart_Timeline_Event_Async_Begin|, and |Dart_Timeline_Event_Async_Instant| to
4567 /// support serialization in Perfetto's proto format.
4568 ///
4569 /// \param label The name of the event. Its lifetime must extend at least until
4570 /// Dart_Cleanup.
4571 /// \param timestamp0 The first timestamp of the event.
4572 /// \param timestamp1_or_id When reporting an event of type
4573 /// |Dart_Timeline_Event_Duration|, the second (end) timestamp of the event
4574 /// should be passed through |timestamp1_or_id|. When reporting an event of
4575 /// type |Dart_Timeline_Event_Async_Begin|, |Dart_Timeline_Event_Async_End|,
4576 /// or |Dart_Timeline_Event_Async_Instant|, the async ID associated with the
4577 /// event should be passed through |timestamp1_or_id|. When reporting an
4578 /// event of type |Dart_Timeline_Event_Flow_Begin|,
4579 /// |Dart_Timeline_Event_Flow_Step|, or |Dart_Timeline_Event_Flow_End|, the
4580 /// flow ID associated with the event should be passed through
4581 /// |timestamp1_or_id|. When reporting an event of type
4582 /// |Dart_Timeline_Event_Begin| or |Dart_Timeline_Event_End|, the event ID
4583 /// associated with the event should be passed through |timestamp1_or_id|.
4584 /// Note that this event ID will only be used by the MacOS recorder. The
4585 /// argument to |timestamp1_or_id| will not be used when reporting events of
4586 /// other types.
4587 /// \param flow_id_count The number of flow IDs associated with this event.
4588 /// \param flow_ids An array of flow IDs associated with this event. The array
4589 /// may be reclaimed when this call returns.
4590 /// \param argument_count The number of argument names and values.
4591 /// \param argument_names An array of names of the arguments. The lifetime of the
4592 /// names must extend at least until Dart_Cleanup. The array may be reclaimed
4593 /// when this call returns.
4594 /// \param argument_values An array of values of the arguments. The values and
4595 /// the array may be reclaimed when this call returns.
4596 pub fn Dart_RecordTimelineEvent(
4597 label: *const ::core::ffi::c_char, timestamp0: i64, timestamp1_or_id: i64, flow_id_count: isize,
4598 flow_ids: *const i64, type_: Dart_Timeline_Event_Type, argument_count: isize,
4599 argument_names: *mut *const ::core::ffi::c_char, argument_values: *mut *const ::core::ffi::c_char,
4600 );
4601}
4602extern "C" {
4603 /// Associates a name with the current thread. This name will be used to name
4604 /// threads in the timeline. Can only be called after a call to Dart_Initialize.
4605 ///
4606 /// \param name The name of the thread.
4607 pub fn Dart_SetThreadName(name: *const ::core::ffi::c_char);
4608}
4609extern "C" {
4610 /// Register a `Dart_TimelineRecorderCallback` to be called as timeline events
4611 /// are completed.
4612 ///
4613 /// The callback will be invoked without a current isolate.
4614 ///
4615 /// The callback will be invoked on the thread completing the event. Because
4616 /// `Dart_TimelineEvent` may be called by any thread, the callback may be called
4617 /// on any thread.
4618 ///
4619 /// The callback may be invoked at any time after `Dart_Initialize` is called and
4620 /// before `Dart_Cleanup` returns.
4621 ///
4622 /// If multiple callbacks are registered, only the last callback registered
4623 /// will be remembered. Providing a NULL callback will clear the registration
4624 /// (i.e., a NULL callback produced a no-op instead of a crash).
4625 ///
4626 /// Setting a callback is insufficient to receive events through the callback. The
4627 /// VM flag `timeline_recorder` must also be set to `callback`.
4628 pub fn Dart_SetTimelineRecorderCallback(callback: Dart_TimelineRecorderCallback);
4629}
4630extern "C" {
4631 /// Return metrics gathered for the VM and individual isolates.
4632 pub fn Dart_IsolateGroupHeapOldUsedMetric(group: Dart_IsolateGroup) -> i64;
4633}
4634extern "C" {
4635 pub fn Dart_IsolateGroupHeapOldCapacityMetric(group: Dart_IsolateGroup) -> i64;
4636}
4637extern "C" {
4638 pub fn Dart_IsolateGroupHeapOldExternalMetric(group: Dart_IsolateGroup) -> i64;
4639}
4640extern "C" {
4641 pub fn Dart_IsolateGroupHeapNewUsedMetric(group: Dart_IsolateGroup) -> i64;
4642}
4643extern "C" {
4644 pub fn Dart_IsolateGroupHeapNewCapacityMetric(group: Dart_IsolateGroup) -> i64;
4645}
4646extern "C" {
4647 pub fn Dart_IsolateGroupHeapNewExternalMetric(group: Dart_IsolateGroup) -> i64;
4648}
4649extern "C" {
4650 pub fn Dart_GetCurrentUserTag() -> Dart_Handle;
4651}
4652extern "C" {
4653 pub fn Dart_GetDefaultUserTag() -> Dart_Handle;
4654}
4655extern "C" {
4656 pub fn Dart_NewUserTag(label: *const ::core::ffi::c_char) -> Dart_Handle;
4657}
4658extern "C" {
4659 pub fn Dart_SetCurrentUserTag(user_tag: Dart_Handle) -> Dart_Handle;
4660}
4661extern "C" {
4662 pub fn Dart_GetUserTagLabel(user_tag: Dart_Handle) -> *mut ::core::ffi::c_char;
4663}
4664extern "C" {
4665 /// Generate heap snapshot of the current isolate group and stream it into the
4666 /// given `callback`. VM would produce snapshot in chunks and send these chunks
4667 /// one by one back to the embedder by invoking the provided `callback`.
4668 ///
4669 /// This API enables embedder to stream snapshot into a file or socket without
4670 /// allocating a buffer to hold the whole snapshot in memory.
4671 ///
4672 /// The isolate group will be paused for the duration of this operation.
4673 ///
4674 /// \param write Callback used to write chunks of the heap snapshot.
4675 ///
4676 /// \param context Opaque context which would be passed on each invocation of
4677 /// `write` callback.
4678 ///
4679 /// \returns `nullptr` if the operation is successful otherwise error message.
4680 /// Caller owns error message string and needs to `free` it.
4681 pub fn Dart_WriteHeapSnapshot(
4682 write: Dart_HeapSnapshotWriteChunkCallback, context: *mut ::core::ffi::c_void,
4683 ) -> *mut ::core::ffi::c_char;
4684}