[][src]Type Definition dart_sys::Dart_IsolateGroupCreateCallback

type Dart_IsolateGroupCreateCallback = Option<unsafe extern "C" fn(script_uri: *const c_char, main: *const c_char, package_root: *const c_char, package_config: *const c_char, flags: *mut Dart_IsolateFlags, callback_data: *mut c_void, error: *mut *mut c_char) -> Dart_Isolate>;

An isolate creation and initialization callback function.

This callback, provided by the embedder, is called when the VM needs to create an isolate. The callback should create an isolate by calling Dart_CreateIsolateGroup and load any scripts required for execution.

This callback may be called on a different thread than the one running the parent isolate.

When the function returns NULL, it is the responsibility of this function to ensure that Dart_ShutdownIsolate has been called if required (for example, if the isolate was created successfully by Dart_CreateIsolateGroup() but the root library fails to load successfully, then the function should call Dart_ShutdownIsolate before returning).

When the function returns NULL, the function should set *error to a malloc-allocated buffer containing a useful error message. The caller of this function (the VM) will make sure that the buffer is freed.

\param script_uri The uri of the main source file or snapshot to load. Either the URI of the parent isolate set in Dart_CreateIsolateGroup for Isolate.spawn, or the argument to Isolate.spawnUri canonicalized by the library tag handler of the parent isolate. The callback is responsible for loading the program by a call to Dart_LoadScriptFromKernel. \param main The name of the main entry point this isolate will eventually run. This is provided for advisory purposes only to improve debugging messages. The main function is not invoked by this function. \param package_root The package root path for this isolate to resolve package imports against. Only one of package_root and package_map parameters is non-NULL. If neither parameter is passed the package resolution of the parent isolate should be used. \param package_map The package map for this isolate to resolve package imports against. The array contains alternating keys and values, terminated by a NULL key. Only one of package_root and package_map parameters is non-NULL. If neither parameter is passed the package resolution of the parent isolate should be used. \param flags Default flags for this isolate being spawned. Either inherited from the spawning isolate or passed as parameters when spawning the isolate from Dart code. \param callback_data The callback data which was passed to the parent isolate when it was created by calling Dart_CreateIsolateGroup(). \param error A structure into which the embedder can place a C string containing an error message in the case of failures.

\return The embedder returns NULL if the creation and initialization was not successful and the isolate if successful.