Getting Started with Erlang: Building application Exercise 3 (random start)

Source: Internet
Author: User

1. Building the directory structure


In my example, the project folder is Bank1
Ebin directory: storing compiled beam files
Include directory: storing HRL files
SRC directory: Storing erl source Files


2. Create a Emakefile file
At compile time, the compiler will handle the Emakefile file as appropriate.
{[' src/* '% specify the erl source file directory],[debug_info,{i, "include"} percent specifies the Include folder, {OutDir, "Ebin"} percent to specify the compiled beam file directory]}.

2, write the compilation script Make.bat

Erl-s make all-s C qpause

Set the-s startup parameter,
-S makes all equivalent to execute Make:all () in Erlang Shell to compile
-S C q equivalent to an Erlang shell executing c:q () exiting the Erlang shell

3. Write the Startup function
File name is Bank.erl
-module (Bank)-export ([start/0]). Start ()->application:start (bank).
Put the Bank.erl file in the SRC directory

3. Write the startup script
@echo Offstart Werl-pa ebin-s bankexit
The start in the script is the Bat command, which starts a separate window to execute Werl
-pa Ebin means to add Bank1/ebin path to Erlang's search path
-S Bank means execute bank:start after starting Erlang shell ()

4. Running Make.bat


5. Running Start.bat


See output:
Percent [<0.34.0>bank_app:10] Start Bank_app ...
That the application, named Bank, has been activated.

6. Sample code Download
Address: http://download.csdn.net/detail/u011471961/8367873

Getting Started with Erlang: Building application Exercise 3 (random start)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.