Home > Software Tutorial > Computer Software > How to view the underlying source code in Erlang

How to view the underlying source code in Erlang

下次还敢
Release: 2024-04-21 03:22:45
Original
558 people have browsed it

There are three ways to view the underlying source code in Erlang: 1. Use the erl -s command line option to start the shell; 2. Use the erl_eval command to load the source code directly from the shell; 3. Use the function c:l/1 Load source code at runtime.

How to view the underlying source code in Erlang

How to view the underlying source code in Erlang

For Erlang programmers, viewing the underlying source code is important for understanding Code behavior and debugging issues are critical. This article will introduce three ways to view the underlying source code in Erlang:

1. erl -s

You can use erl -s Command line option to launch the Erlang shell and view the source code there. For example:

<code>$ erl -serl_eval -s hi</code>
Copy after login

This will start the Erlang shell and load the source code of the hi module.

2. erl_eval

You can also use the erl_eval command to load source code directly from the Erlang shell. For example:

<code>$ erl
1> erl_eval(hi).</code>
Copy after login

This command will load the source code of the hi module and print it to the shell.

3. c:l/1

Finally, you can use the c:l/1 function to load the source code at runtime. This function takes a filename or module name as an argument and loads the source code into the Erlang virtual machine (BEAM). For example:

<code>$ erl
1> c:l("hi").</code>
Copy after login

This command will load the source code of the hi module and compile it into BEAM.

The above is the detailed content of How to view the underlying source code in Erlang. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template