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]).

   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().

转载于:https://my.oschina.net/sinpo/blog/42068

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值