Loadable extensions are presented in full detail in Writing Extensions for gawk
.
They provide a way to add functions to gawk
which can call
out to other facilities written in C or C++.
For the purposes of
wc.awk, it’s enough to know that the extension is loaded
with the @load
directive, and the additional function we
will use is called mbs_length()
. This function returns the
number of bytes in a string, not the number of characters.
The "mbs"
extension comes from the gawkextlib
project. See The gawkextlib
Project for more information.