OLD | NEW |
1 # Mojo Embedder Development Kit (EDK) | 1 # ![Mojo Graphic](https://goo.gl/6CdlbH) Mojo Embedder Development Kit (EDK) |
| 2 This document is a subset of the [Mojo documentation](/mojo). |
| 3 |
| 4 [TOC] |
| 5 |
| 6 ## Overview |
2 | 7 |
3 The Mojo EDK is a (binary-unstable) API which enables a process to use Mojo both | 8 The Mojo EDK is a (binary-unstable) API which enables a process to use Mojo both |
4 internally and for IPC to other Mojo-embedding processes. | 9 internally and for IPC to other Mojo-embedding processes. |
5 | 10 |
6 Using any of the API surface in `//mojo/edk/embedder` requires (somewhat | 11 Using any of the API surface in `//mojo/edk/embedder` requires (somewhat |
7 confusingly) a direct dependency on the GN `//mojo/edk/system` target. Despite | 12 confusingly) a direct dependency on the GN `//mojo/edk/system` target. Despite |
8 this fact, you should never reference any of the headers in `mojo/edk/system` | 13 this fact, you should never reference any of the headers in `mojo/edk/system` |
9 directly, as everything there is considered to be an internal detail of the EDK. | 14 directly, as everything there is considered to be an internal detail of the EDK. |
10 | 15 |
| 16 **NOTE:** Unless you are introducing a new binary entry point into the system |
| 17 (*e.g.,* a new executable with a new `main()` definition), you probably don't |
| 18 need to know anything about the EDK API. Most processes defined in the Chrome |
| 19 repo today already fully initialize the EDK so that Mojo's other public APIs |
| 20 "just work" out of the box. |
| 21 |
11 ## Basic Initialization | 22 ## Basic Initialization |
12 | 23 |
13 In order to use Mojo in a given process, it's necessary to call | 24 In order to use Mojo in a given process, it's necessary to call |
14 `mojo::edk::Init` exactly once: | 25 `mojo::edk::Init` exactly once: |
15 | 26 |
16 ``` | 27 ``` |
17 #include "mojo/edk/embedder/embedder.h" | 28 #include "mojo/edk/embedder/embedder.h" |
18 | 29 |
19 int main(int argc, char** argv) { | 30 int main(int argc, char** argv) { |
20 mojo::edk::Init(); | 31 mojo::edk::Init(); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 module local.mojom; | 324 module local.mojom; |
314 | 325 |
315 interface Foo { | 326 interface Foo { |
316 DoSomeStuff(int32 n); | 327 DoSomeStuff(int32 n); |
317 }; | 328 }; |
318 ``` | 329 ``` |
319 | 330 |
320 Once you've bootstrapped your process connection with a real mojom interface, | 331 Once you've bootstrapped your process connection with a real mojom interface, |
321 you can avoid any further mucking around with EDK APIs or raw message pipe | 332 you can avoid any further mucking around with EDK APIs or raw message pipe |
322 handles, as everything beyond this point - including the passing of other | 333 handles, as everything beyond this point - including the passing of other |
323 interface pipes - can be handled eloquently using public bindings APIs. | 334 interface pipes - can be handled eloquently using |
| 335 [public bindings APIs](/mojo#High-Level-Bindings-APIs). |
324 | 336 |
325 See [additional Mojo documentation]( | 337 ## Setting System Properties |
326 https://www.chromium.org/developers/design-documents/mojo) for more | 338 |
327 information. | 339 The public Mojo C System API exposes a |
| 340 [**`MojoGetProperty`**](/mojo/public/c/system#MojoGetProperty) function for |
| 341 querying global, embedder-defined property values. These can be set by calling: |
| 342 |
| 343 ``` |
| 344 mojo::edk::SetProperty(MojoPropertyType type, const void* value) |
| 345 ``` |
| 346 |
OLD | NEW |