Skip to content

Commit d56673e

Browse files
defndaineshappi
authored andcommitted
Fix Chapter 16 Heading
It’s the only chapter that’s prefixed with “Chapter: ”. Also addressing a couple capitalization issues.
1 parent 89fbe85 commit d56673e

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

chapters/c.asciidoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[[CH-C]]
2-
== Chapter: Interfacing other languages and extending BEAM and ERTS
2+
== Interfacing Other Languages and Extending BEAM and ERTS
33

44
=== Introduction
55
Interfacing C, C++, Rust, or assembler provides an opportunity to extend the capabilities of the BEAM. In this chapter, we will use C for most examples, but the methods described can be used to interface almost any other programming language. We will give some examples of Rust and Java in this chapter. In most cases, you can replace C with any other language in the rest of this chapter, but we will just use C for brevity.
@@ -425,7 +425,7 @@ Imagine implementing a simple BIF to calculate the factorial of a number. The BI
425425
2. Perform the computation efficiently in C.
426426
3. Return the result to the Erlang environment.
427427

428-
Find the code in erts where bifs are defined:
428+
Find the code in erts where BIFs are defined:
429429
https://github.com/erlang/otp/blob/master/erts/emulator/beam/bif.c
430430
or in this case perhaps in https://github.com/erlang/otp/blob/master/erts/emulator/beam/erl_math.c
431431

@@ -830,8 +830,8 @@ NIFs are functions implemented in C or C++ (or other languages) that are called
830830
They provide a way to dynamically extend Erlang with native code for performance-critical operations or interfacing with external libraries.
831831
Improper use can still destabilize the VM, so they should be used cautiously.
832832

833-
How to use Nifs is nowadays well documented in the link:https://www.erlang.org/doc/tutorial/introduction[Interoperability Tutorial] in the
834-
link:https://www.erlang.org/doc/system/nif.html[Nif section], but we will go through the basics here.
833+
How to use NIFs is nowadays well documented in the link:https://www.erlang.org/doc/tutorial/introduction[Interoperability Tutorial] in the
834+
link:https://www.erlang.org/doc/system/nif.html[NIF section], but we will go through the basics here.
835835

836836
==== Implementing a Simple NIF
837837
A simple C-based NIF for fast integer addition:
@@ -884,4 +884,3 @@ Then in Erlang:
884884
Keep NIF execution **short** to avoid blocking the BEAM scheduler. Use NIFs for **performance-critical** operations and **interfacing with external libraries**.
885885
**Use dirty schedulers** for long-running operations.
886886
Always **validate inputs** to prevent crashes.
887-

0 commit comments

Comments
 (0)