Skip to content

Commit 088eaad

Browse files
authored
Document null pointer behavior of the loader helpers (#1280)
1 parent 2b4dce0 commit 088eaad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/loader/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ Besides demangling classes exported from your entry file to a handy object struc
4343
```
4444

4545
* **__getString**(ptr: `number`): `string`<br />
46-
Copies a string's value from the module's memory.
46+
Copies a string's value from the module's memory. `ptr` must not be zero.
4747

4848
```ts
4949
var str = module.__getString(ptr);
5050
...
5151
```
5252

5353
* **__getArrayBuffer**(ptr: `number`): `ArrayBuffer`<br />
54-
Copies an ArrayBuffer's value from the module's memory.
54+
Copies an ArrayBuffer's value from the module's memory. `ptr` must not be zero.
5555

5656
* **__getArray**(ptr: `number`): `number[]`<br />
57-
Copies an array's values from the module's memory. Infers the array type from RTTI.
57+
Copies an array's values from the module's memory. Infers the array type from RTTI. `ptr` must not be zero.
5858

5959
```ts
6060
var arr = module.__getArray(ptr);
@@ -76,7 +76,7 @@ Besides demangling classes exported from your entry file to a handy object struc
7676
**__getFloat64Array**(ptr: `number`): `Float64Array`
7777

7878
* **__getArrayView**(ptr: `number`): `TypedArray`<br />
79-
Gets a live view on the values of an array in the module's memory. Infers the array type from RTTI.
79+
Gets a live view on the values of an array in the module's memory. Infers the array type from RTTI. `ptr` must not be zero.
8080

8181
This differs from `__getArray` in that the data isn't copied but remains *live* in both directions. That's faster but also unsafe because if the array grows or becomes released, the view will no longer represent the correct memory region and modifying its values in this state will most likely corrupt memory. Use, but use with care.
8282

0 commit comments

Comments
 (0)