You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Include `-DV8_ENABLE_SANDBOX` to fix `CHECK` failures upon running `./hello_world`.
Also, switch from `master` to `main` as branch name in link targets.
Copy file name to clipboardExpand all lines: src/docs/embed.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ This document is intended for C++ programmers who want to embed the V8 JavaScrip
10
10
11
11
## Hello world
12
12
13
-
Let’s look at a [Hello World example](https://chromium.googlesource.com/v8/v8/+/branch-heads/6.8/samples/hello-world.cc) that takes a JavaScript statement as a string argument, executes it as JavaScript code, and prints the result to standard out.
13
+
Let’s look at a [Hello World example](https://chromium.googlesource.com/v8/v8/+/branch-heads/11.9/samples/hello-world.cc) that takes a JavaScript statement as a string argument, executes it as JavaScript code, and prints the result to standard out.
14
14
15
15
First, some key concepts:
16
16
@@ -26,7 +26,7 @@ These concepts are discussed in greater detail in [the advanced guide](/docs/emb
26
26
Follow the steps below to run the example yourself:
27
27
28
28
1. Download the V8 source code by following [the Git instructions](/docs/source-code#using-git).
29
-
1. The instructions for this hello world example have last been tested with V8 v10.5.1. You can check out this branch with `git checkout refs/tags/10.5.1 -b sample -t`
29
+
1. The instructions for this hello world example have last been tested with V8 v11.9. You can check out this branch with `git checkout branch-heads/11.9 -b sample -t`
30
30
1. Create a build configuration using the helper script:
31
31
32
32
```bash
@@ -48,7 +48,7 @@ Follow the steps below to run the example yourself:
48
48
1. Compile `hello-world.cc`, linking to the static library created in the build process. For example, on 64bit Linux using the GNU compiler:
1. For more complex code, V8 fails without an ICU data file. Copy this file to where your binary is stored:
@@ -65,17 +65,17 @@ Follow the steps below to run the example yourself:
65
65
66
66
1. It prints `Hello, World!`. Yay!
67
67
68
-
If you are looking foran example which isin sync with master, check out the file [`hello-world.cc`](https://chromium.googlesource.com/v8/v8/+/master/samples/hello-world.cc). This is a very simple example and you’ll likely want to do more than just execute scripts as strings. [The advanced guide below](#advanced-guide) contains more information for V8 embedders.
68
+
If you are looking foran example which isin sync with the main branch, check out the file [`hello-world.cc`](https://chromium.googlesource.com/v8/v8/+/main/samples/hello-world.cc). This is a very simple example and you’ll likely want to do more than just execute scripts as strings. [The advanced guide below](#advanced-guide) contains more information for V8 embedders.
69
69
70
70
## More example code
71
71
72
72
The following samples are provided as part of the source code download.
This sample provides the code necessary to extend a hypothetical HTTP request processing application — which could be part of a web server, for example — so that it is scriptable. It takes a JavaScript script as an argument, which must provide a functioncalled`Process`. The JavaScript `Process`functioncan be used to, for example, collect information such as how many hits each page served by the fictional web server gets.
This sample takes filenames as arguments then reads and executes their contents. Includes a command prompt at which you can enter JavaScript code snippets which are then executed. In this sample additional functions like `print` are also added to JavaScript through the use of object and functiontemplates.
0 commit comments