5.编译并运行erlang程序

1.中止erlang系统方法:
   ctrl+C(Windows下 ctrl+Break).
   不可控关闭BIF函数: erlang:halt() 强制中止系统(小瑕疵:对于大型的数据库操做程序,可能在下次须要进行一些回复操做)
   可控关闭:q().该函数是init:stop()在shell中的简写,该操做会作一些清除和关闭操做,保证系统正确关闭
2.为文件加载器设定加载路径
   code:get_path(). 得到当前设定的文件加载路径列表
   @spec code:add_patha(Dir) 增长新目录到当前加载路径列表的开头
   @spec code:add_patha(Dir) 增长新目录到当前加载路径列表的末尾
   @spec code:all_loaded()   返回全部加载的模块,有利于肯定那些模块加载出错
   @spec code:clash() 分析加载目录是否有重复模块
   注:code模块有些函数能够用来分析加载路径
   init:get_argument(home) 得到erlang系统所需的home目录
3. erlang程序运行方式
   erlang代码以下
   -module(hello).
   -export([start/0]).linux

   start() ->
    io:format("Hello world~n").
   (1). shell中编译运行:
       c(hello).
       hello:start().
   (2). 命令行中编译运行:
       F:\programming\Erlang\erlang程序设计中文版\code>erlc hello.erl
       F:\programming\Erlang\erlang程序设计中文版\code>erl -noshell -s hello start -s init stop
   (3). window下bat批处理文件中运行
       "D:\erlang5\bin\erl.exe" -noshell -s hello start -s init stop
   (4). 快速脚本
        erl -eval 'io:format("Memory:~p~n",[erlang:memory(total)])' -noshell -s init stop (windows下无输出)
   (5). escript脚本运行,代码不会编译为beam字节码(在window下是否运行,待研究)
        脚本文件名:hello
        #!/usr/bin/env escript
        main(_) ->
            io:format("Hello world\n").
        在unix下运行: chmod u+x hello
                       ./hello
        在window下运行:escript hello
4.使用makefile进行自动编译
5.解决系统死锁问题
6.shell无响应  shell JCL(shell job control languge) 在Eshell V5.6.2中不起做用或着这仅仅是在window下的问题,linux待验证(待解决)
7.得到erlang帮助  112页
8.erlang崩溃转储文件分析 webtool:start().web

相关文章
相关标签/搜索