Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 906

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- code</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/kernel-2.15.3.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Kernel</strong><br><strong>Reference Manual</strong><br><small>Version 2.15.3</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p>
<ul class="flipMenu">
<li title="kernel (App)"><a href="kernel_app.html">kernel (App)
                </a></li>
<li id="no" title="application " expanded="false">application<ul>
<li><a href="application.html">
                  Top of manual page
                </a></li>
<li title="get_all_env-0"><a href="application.html#get_all_env-0">get_all_env/0</a></li>
<li title="get_all_env-1"><a href="application.html#get_all_env-1">get_all_env/1</a></li>
<li title="get_all_key-0"><a href="application.html#get_all_key-0">get_all_key/0</a></li>
<li title="get_all_key-1"><a href="application.html#get_all_key-1">get_all_key/1</a></li>
<li title="get_application-0"><a href="application.html#get_application-0">get_application/0</a></li>
<li title="get_application-1"><a href="application.html#get_application-1">get_application/1</a></li>
<li title="get_env-1"><a href="application.html#get_env-1">get_env/1</a></li>
<li title="get_env-2"><a href="application.html#get_env-2">get_env/2</a></li>
<li title="get_key-1"><a href="application.html#get_key-1">get_key/1</a></li>
<li title="get_key-2"><a href="application.html#get_key-2">get_key/2</a></li>
<li title="load-1"><a href="application.html#load-1">load/1</a></li>
<li title="load-2"><a href="application.html#load-2">load/2</a></li>
<li title="loaded_applications-0"><a href="application.html#loaded_applications-0">loaded_applications/0</a></li>
<li title="permit-2"><a href="application.html#permit-2">permit/2</a></li>
<li title="set_env-3"><a href="application.html#set_env-3">set_env/3</a></li>
<li title="set_env-4"><a href="application.html#set_env-4">set_env/4</a></li>
<li title="start-1"><a href="application.html#start-1">start/1</a></li>
<li title="start-2"><a href="application.html#start-2">start/2</a></li>
<li title="start_type-0"><a href="application.html#start_type-0">start_type/0</a></li>
<li title="stop-1"><a href="application.html#stop-1">stop/1</a></li>
<li title="takeover-2"><a href="application.html#takeover-2">takeover/2</a></li>
<li title="unload-1"><a href="application.html#unload-1">unload/1</a></li>
<li title="unset_env-2"><a href="application.html#unset_env-2">unset_env/2</a></li>
<li title="unset_env-3"><a href="application.html#unset_env-3">unset_env/3</a></li>
<li title="which_applications-0"><a href="application.html#which_applications-0">which_applications/0</a></li>
<li title="which_applications-1"><a href="application.html#which_applications-1">which_applications/1</a></li>
<li title="Module:start-2"><a href="application.html#Module:start-2">Module:start/2</a></li>
<li title="Module:start_phase-3"><a href="application.html#Module:start_phase-3">Module:start_phase/3</a></li>
<li title="Module:prep_stop-1"><a href="application.html#Module:prep_stop-1">Module:prep_stop/1</a></li>
<li title="Module:stop-1"><a href="application.html#Module:stop-1">Module:stop/1</a></li>
<li title="Module:config_change-3"><a href="application.html#Module:config_change-3">Module:config_change/3</a></li>
</ul>
</li>
<li id="no" title="auth " expanded="false">auth<ul>
<li><a href="auth.html">
                  Top of manual page
                </a></li>
<li title="is_auth-1"><a href="auth.html#is_auth-1">is_auth/1</a></li>
<li title="cookie-0"><a href="auth.html#cookie-0">cookie/0</a></li>
<li title="cookie-1"><a href="auth.html#cookie-1">cookie/1</a></li>
<li title="node_cookie-1"><a href="auth.html#node_cookie-1">node_cookie/1</a></li>
<li title="node_cookie-2"><a href="auth.html#node_cookie-2">node_cookie/2</a></li>
</ul>
</li>
<li id="loadscrollpos" title="code " expanded="true">code<ul>
<li><a href="code.html">
                  Top of manual page
                </a></li>
<li title="set_path-1"><a href="code.html#set_path-1">set_path/1</a></li>
<li title="get_path-0"><a href="code.html#get_path-0">get_path/0</a></li>
<li title="add_path-1"><a href="code.html#add_path-1">add_path/1</a></li>
<li title="add_pathz-1"><a href="code.html#add_pathz-1">add_pathz/1</a></li>
<li title="add_patha-1"><a href="code.html#add_patha-1">add_patha/1</a></li>
<li title="add_paths-1"><a href="code.html#add_paths-1">add_paths/1</a></li>
<li title="add_pathsz-1"><a href="code.html#add_pathsz-1">add_pathsz/1</a></li>
<li title="add_pathsa-1"><a href="code.html#add_pathsa-1">add_pathsa/1</a></li>
<li title="del_path-1"><a href="code.html#del_path-1">del_path/1</a></li>
<li title="replace_path-2"><a href="code.html#replace_path-2">replace_path/2</a></li>
<li title="load_file-1"><a href="code.html#load_file-1">load_file/1</a></li>
<li title="load_abs-1"><a href="code.html#load_abs-1">load_abs/1</a></li>
<li title="ensure_loaded-1"><a href="code.html#ensure_loaded-1">ensure_loaded/1</a></li>
<li title="load_binary-3"><a href="code.html#load_binary-3">load_binary/3</a></li>
<li title="delete-1"><a href="code.html#delete-1">delete/1</a></li>
<li title="purge-1"><a href="code.html#purge-1">purge/1</a></li>
<li title="soft_purge-1"><a href="code.html#soft_purge-1">soft_purge/1</a></li>
<li title="is_loaded-1"><a href="code.html#is_loaded-1">is_loaded/1</a></li>
<li title="all_loaded-0"><a href="code.html#all_loaded-0">all_loaded/0</a></li>
<li title="which-1"><a href="code.html#which-1">which/1</a></li>
<li title="get_object_code-1"><a href="code.html#get_object_code-1">get_object_code/1</a></li>
<li title="root_dir-0"><a href="code.html#root_dir-0">root_dir/0</a></li>
<li title="lib_dir-0"><a href="code.html#lib_dir-0">lib_dir/0</a></li>
<li title="lib_dir-1"><a href="code.html#lib_dir-1">lib_dir/1</a></li>
<li title="lib_dir-2"><a href="code.html#lib_dir-2">lib_dir/2</a></li>
<li title="compiler_dir-0"><a href="code.html#compiler_dir-0">compiler_dir/0</a></li>
<li title="priv_dir-1"><a href="code.html#priv_dir-1">priv_dir/1</a></li>
<li title="objfile_extension-0"><a href="code.html#objfile_extension-0">objfile_extension/0</a></li>
<li title="stick_dir-1"><a href="code.html#stick_dir-1">stick_dir/1</a></li>
<li title="unstick_dir-1"><a href="code.html#unstick_dir-1">unstick_dir/1</a></li>
<li title="is_sticky-1"><a href="code.html#is_sticky-1">is_sticky/1</a></li>
<li title="rehash-0"><a href="code.html#rehash-0">rehash/0</a></li>
<li title="where_is_file-1"><a href="code.html#where_is_file-1">where_is_file/1</a></li>
<li title="clash-0"><a href="code.html#clash-0">clash/0</a></li>
<li title="is_module_native-1"><a href="code.html#is_module_native-1">is_module_native/1</a></li>
</ul>
</li>
<li id="no" title="disk_log " expanded="false">disk_log<ul>
<li><a href="disk_log.html">
                  Top of manual page
                </a></li>
<li title="accessible_logs-0"><a href="disk_log.html#accessible_logs-0">accessible_logs/0</a></li>
<li title="alog-2"><a href="disk_log.html#alog-2">alog/2</a></li>
<li title="balog-2"><a href="disk_log.html#balog-2">balog/2</a></li>
<li title="alog_terms-2"><a href="disk_log.html#alog_terms-2">alog_terms/2</a></li>
<li title="balog_terms-2"><a href="disk_log.html#balog_terms-2">balog_terms/2</a></li>
<li title="block-1"><a href="disk_log.html#block-1">block/1</a></li>
<li title="block-2"><a href="disk_log.html#block-2">block/2</a></li>
<li title="change_header-2"><a href="disk_log.html#change_header-2">change_header/2</a></li>
<li title="change_notify-3"><a href="disk_log.html#change_notify-3">change_notify/3</a></li>
<li title="change_size-2"><a href="disk_log.html#change_size-2">change_size/2</a></li>
<li title="chunk-2"><a href="disk_log.html#chunk-2">chunk/2</a></li>
<li title="chunk-3"><a href="disk_log.html#chunk-3">chunk/3</a></li>
<li title="bchunk-2"><a href="disk_log.html#bchunk-2">bchunk/2</a></li>
<li title="bchunk-3"><a href="disk_log.html#bchunk-3">bchunk/3</a></li>
<li title="chunk_info-1"><a href="disk_log.html#chunk_info-1">chunk_info/1</a></li>
<li title="chunk_step-3"><a href="disk_log.html#chunk_step-3">chunk_step/3</a></li>
<li title="close-1"><a href="disk_log.html#close-1">close/1</a></li>
<li title="format_error-1"><a href="disk_log.html#format_error-1">format_error/1</a></li>
<li title="inc_wrap_file-1"><a href="disk_log.html#inc_wrap_file-1">inc_wrap_file/1</a></li>
<li title="info-1"><a href="disk_log.html#info-1">info/1</a></li>
<li title="lclose-1"><a href="disk_log.html#lclose-1">lclose/1</a></li>
<li title="lclose-2"><a href="disk_log.html#lclose-2">lclose/2</a></li>
<li title="log-2"><a href="disk_log.html#log-2">log/2</a></li>
<li title="blog-2"><a href="disk_log.html#blog-2">blog/2</a></li>
<li title="log_terms-2"><a href="disk_log.html#log_terms-2">log_terms/2</a></li>
<li title="blog_terms-2"><a href="disk_log.html#blog_terms-2">blog_terms/2</a></li>
<li title="open-1"><a href="disk_log.html#open-1">open/1</a></li>
<li title="pid2name-1"><a href="disk_log.html#pid2name-1">pid2name/1</a></li>
<li title="reopen-2"><a href="disk_log.html#reopen-2">reopen/2</a></li>
<li title="reopen-3"><a href="disk_log.html#reopen-3">reopen/3</a></li>
<li title="breopen-3"><a href="disk_log.html#breopen-3">breopen/3</a></li>
<li title="sync-1"><a href="disk_log.html#sync-1">sync/1</a></li>
<li title="truncate-1"><a href="disk_log.html#truncate-1">truncate/1</a></li>
<li title="truncate-2"><a href="disk_log.html#truncate-2">truncate/2</a></li>
<li title="btruncate-2"><a href="disk_log.html#btruncate-2">btruncate/2</a></li>
<li title="unblock-1"><a href="disk_log.html#unblock-1">unblock/1</a></li>
</ul>
</li>
<li id="no" title="erl_boot_server " expanded="false">erl_boot_server<ul>
<li><a href="erl_boot_server.html">
                  Top of manual page
                </a></li>
<li title="start-1"><a href="erl_boot_server.html#start-1">start/1</a></li>
<li title="start_link-1"><a href="erl_boot_server.html#start_link-1">start_link/1</a></li>
<li title="add_slave-1"><a href="erl_boot_server.html#add_slave-1">add_slave/1</a></li>
<li title="delete_slave-1"><a href="erl_boot_server.html#delete_slave-1">delete_slave/1</a></li>
<li title="which_slaves-0"><a href="erl_boot_server.html#which_slaves-0">which_slaves/0</a></li>
</ul>
</li>
<li id="no" title="erl_ddll " expanded="false">erl_ddll<ul>
<li><a href="erl_ddll.html">
                  Top of manual page
                </a></li>
<li title="demonitor-1"><a href="erl_ddll.html#demonitor-1">demonitor/1</a></li>
<li title="info-0"><a href="erl_ddll.html#info-0">info/0</a></li>
<li title="info-1"><a href="erl_ddll.html#info-1">info/1</a></li>
<li title="info-2"><a href="erl_ddll.html#info-2">info/2</a></li>
<li title="load-2"><a href="erl_ddll.html#load-2">load/2</a></li>
<li title="load_driver-2"><a href="erl_ddll.html#load_driver-2">load_driver/2</a></li>
<li title="monitor-2"><a href="erl_ddll.html#monitor-2">monitor/2</a></li>
<li title="reload-2"><a href="erl_ddll.html#reload-2">reload/2</a></li>
<li title="reload_driver-2"><a href="erl_ddll.html#reload_driver-2">reload_driver/2</a></li>
<li title="try_load-3"><a href="erl_ddll.html#try_load-3">try_load/3</a></li>
<li title="try_unload-2"><a href="erl_ddll.html#try_unload-2">try_unload/2</a></li>
<li title="unload-1"><a href="erl_ddll.html#unload-1">unload/1</a></li>
<li title="unload_driver-1"><a href="erl_ddll.html#unload_driver-1">unload_driver/1</a></li>
<li title="loaded_drivers-0"><a href="erl_ddll.html#loaded_drivers-0">loaded_drivers/0</a></li>
<li title="format_error-1"><a href="erl_ddll.html#format_error-1">format_error/1</a></li>
</ul>
</li>
<li title="erl_prim_loader"><a href="erl_prim_loader.html">erl_prim_loader</a></li>
<li title="erlang"><a href="erlang.html">erlang</a></li>
<li id="no" title="error_handler " expanded="false">error_handler<ul>
<li><a href="error_handler.html">
                  Top of manual page
                </a></li>
<li title="undefined_function-3"><a href="error_handler.html#undefined_function-3">undefined_function/3</a></li>
<li title="undefined_lambda-3"><a href="error_handler.html#undefined_lambda-3">undefined_lambda/3</a></li>
</ul>
</li>
<li id="no" title="error_logger " expanded="false">error_logger<ul>
<li><a href="error_logger.html">
                  Top of manual page
                </a></li>
<li title="error_msg-1"><a href="error_logger.html#error_msg-1">error_msg/1</a></li>
<li title="error_msg-2"><a href="error_logger.html#error_msg-2">error_msg/2</a></li>
<li title="format-2"><a href="error_logger.html#format-2">format/2</a></li>
<li title="error_report-1"><a href="error_logger.html#error_report-1">error_report/1</a></li>
<li title="error_report-2"><a href="error_logger.html#error_report-2">error_report/2</a></li>
<li title="warning_map-0"><a href="error_logger.html#warning_map-0">warning_map/0</a></li>
<li title="warning_msg-1"><a href="error_logger.html#warning_msg-1">warning_msg/1</a></li>
<li title="warning_msg-2"><a href="error_logger.html#warning_msg-2">warning_msg/2</a></li>
<li title="warning_report-1"><a href="error_logger.html#warning_report-1">warning_report/1</a></li>
<li title="warning_report-2"><a href="error_logger.html#warning_report-2">warning_report/2</a></li>
<li title="info_msg-1"><a href="error_logger.html#info_msg-1">info_msg/1</a></li>
<li title="info_msg-2"><a href="error_logger.html#info_msg-2">info_msg/2</a></li>
<li title="info_report-1"><a href="error_logger.html#info_report-1">info_report/1</a></li>
<li title="info_report-2"><a href="error_logger.html#info_report-2">info_report/2</a></li>
<li title="add_report_handler-1"><a href="error_logger.html#add_report_handler-1">add_report_handler/1</a></li>
<li title="add_report_handler-2"><a href="error_logger.html#add_report_handler-2">add_report_handler/2</a></li>
<li title="delete_report_handler-1"><a href="error_logger.html#delete_report_handler-1">delete_report_handler/1</a></li>
<li title="tty-1"><a href="error_logger.html#tty-1">tty/1</a></li>
<li title="logfile-1"><a href="error_logger.html#logfile-1">logfile/1</a></li>
</ul>
</li>
<li id="no" title="file " expanded="false">file<ul>
<li><a href="file.html">
                  Top of manual page
                </a></li>
<li title="advise-4"><a href="file.html#advise-4">advise/4</a></li>
<li title="change_group-2"><a href="file.html#change_group-2">change_group/2</a></li>
<li title="change_mode-2"><a href="file.html#change_mode-2">change_mode/2</a></li>
<li title="change_owner-2"><a href="file.html#change_owner-2">change_owner/2</a></li>
<li title="change_owner-3"><a href="file.html#change_owner-3">change_owner/3</a></li>
<li title="change_time-2"><a href="file.html#change_time-2">change_time/2</a></li>
<li title="change_time-3"><a href="file.html#change_time-3">change_time/3</a></li>
<li title="close-1"><a href="file.html#close-1">close/1</a></li>
<li title="consult-1"><a href="file.html#consult-1">consult/1</a></li>
<li title="copy-2"><a href="file.html#copy-2">copy/2</a></li>
<li title="copy-3"><a href="file.html#copy-3">copy/3</a></li>
<li title="del_dir-1"><a href="file.html#del_dir-1">del_dir/1</a></li>
<li title="delete-1"><a href="file.html#delete-1">delete/1</a></li>
<li title="eval-1"><a href="file.html#eval-1">eval/1</a></li>
<li title="eval-2"><a href="file.html#eval-2">eval/2</a></li>
<li title="file_info-1"><a href="file.html#file_info-1">file_info/1</a></li>
<li title="format_error-1"><a href="file.html#format_error-1">format_error/1</a></li>
<li title="get_cwd-0"><a href="file.html#get_cwd-0">get_cwd/0</a></li>
<li title="get_cwd-1"><a href="file.html#get_cwd-1">get_cwd/1</a></li>
<li title="list_dir-1"><a href="file.html#list_dir-1">list_dir/1</a></li>
<li title="make_dir-1"><a href="file.html#make_dir-1">make_dir/1</a></li>
<li title="make_link-2"><a href="file.html#make_link-2">make_link/2</a></li>
<li title="make_symlink-2"><a href="file.html#make_symlink-2">make_symlink/2</a></li>
<li title="native_name_encoding-0"><a href="file.html#native_name_encoding-0">native_name_encoding/0</a></li>
<li title="open-2"><a href="file.html#open-2">open/2</a></li>
<li title="path_consult-2"><a href="file.html#path_consult-2">path_consult/2</a></li>
<li title="path_eval-2"><a href="file.html#path_eval-2">path_eval/2</a></li>
<li title="path_open-3"><a href="file.html#path_open-3">path_open/3</a></li>
<li title="path_script-2"><a href="file.html#path_script-2">path_script/2</a></li>
<li title="path_script-3"><a href="file.html#path_script-3">path_script/3</a></li>
<li title="pid2name-1"><a href="file.html#pid2name-1">pid2name/1</a></li>
<li title="position-2"><a href="file.html#position-2">position/2</a></li>
<li title="pread-2"><a href="file.html#pread-2">pread/2</a></li>
<li title="pread-3"><a href="file.html#pread-3">pread/3</a></li>
<li title="pwrite-2"><a href="file.html#pwrite-2">pwrite/2</a></li>
<li title="pwrite-3"><a href="file.html#pwrite-3">pwrite/3</a></li>
<li title="read-2"><a href="file.html#read-2">read/2</a></li>
<li title="read_file-1"><a href="file.html#read_file-1">read_file/1</a></li>
<li title="read_file_info-1"><a href="file.html#read_file_info-1">read_file_info/1</a></li>
<li title="read_file_info-2"><a href="file.html#read_file_info-2">read_file_info/2</a></li>
<li title="read_line-1"><a href="file.html#read_line-1">read_line/1</a></li>
<li title="read_link-1"><a href="file.html#read_link-1">read_link/1</a></li>
<li title="read_link_info-1"><a href="file.html#read_link_info-1">read_link_info/1</a></li>
<li title="read_link_info-2"><a href="file.html#read_link_info-2">read_link_info/2</a></li>
<li title="rename-2"><a href="file.html#rename-2">rename/2</a></li>
<li title="script-1"><a href="file.html#script-1">script/1</a></li>
<li title="script-2"><a href="file.html#script-2">script/2</a></li>
<li title="set_cwd-1"><a href="file.html#set_cwd-1">set_cwd/1</a></li>
<li title="sync-1"><a href="file.html#sync-1">sync/1</a></li>
<li title="datasync-1"><a href="file.html#datasync-1">datasync/1</a></li>
<li title="truncate-1"><a href="file.html#truncate-1">truncate/1</a></li>
<li title="sendfile-2"><a href="file.html#sendfile-2">sendfile/2</a></li>
<li title="sendfile-5"><a href="file.html#sendfile-5">sendfile/5</a></li>
<li title="write-2"><a href="file.html#write-2">write/2</a></li>
<li title="write_file-2"><a href="file.html#write_file-2">write_file/2</a></li>
<li title="write_file-3"><a href="file.html#write_file-3">write_file/3</a></li>
<li title="write_file_info-2"><a href="file.html#write_file_info-2">write_file_info/2</a></li>
<li title="write_file_info-3"><a href="file.html#write_file_info-3">write_file_info/3</a></li>
</ul>
</li>
<li id="no" title="gen_tcp " expanded="false">gen_tcp<ul>
<li><a href="gen_tcp.html">
                  Top of manual page
                </a></li>
<li title="connect-3"><a href="gen_tcp.html#connect-3">connect/3</a></li>
<li title="connect-4"><a href="gen_tcp.html#connect-4">connect/4</a></li>
<li title="listen-2"><a href="gen_tcp.html#listen-2">listen/2</a></li>
<li title="accept-1"><a href="gen_tcp.html#accept-1">accept/1</a></li>
<li title="accept-2"><a href="gen_tcp.html#accept-2">accept/2</a></li>
<li title="send-2"><a href="gen_tcp.html#send-2">send/2</a></li>
<li title="recv-2"><a href="gen_tcp.html#recv-2">recv/2</a></li>
<li title="recv-3"><a href="gen_tcp.html#recv-3">recv/3</a></li>
<li title="controlling_process-2"><a href="gen_tcp.html#controlling_process-2">controlling_process/2</a></li>
<li title="close-1"><a href="gen_tcp.html#close-1">close/1</a></li>
<li title="shutdown-2"><a href="gen_tcp.html#shutdown-2">shutdown/2</a></li>
</ul>
</li>
<li id="no" title="gen_udp " expanded="false">gen_udp<ul>
<li><a href="gen_udp.html">
                  Top of manual page
                </a></li>
<li title="open-1"><a href="gen_udp.html#open-1">open/1</a></li>
<li title="open-2"><a href="gen_udp.html#open-2">open/2</a></li>
<li title="send-4"><a href="gen_udp.html#send-4">send/4</a></li>
<li title="recv-2"><a href="gen_udp.html#recv-2">recv/2</a></li>
<li title="recv-3"><a href="gen_udp.html#recv-3">recv/3</a></li>
<li title="controlling_process-2"><a href="gen_udp.html#controlling_process-2">controlling_process/2</a></li>
<li title="close-1"><a href="gen_udp.html#close-1">close/1</a></li>
</ul>
</li>
<li id="no" title="gen_sctp " expanded="false">gen_sctp<ul>
<li><a href="gen_sctp.html">
                  Top of manual page
                </a></li>
<li title="abort-2"><a href="gen_sctp.html#abort-2">abort/2</a></li>
<li title="close-1"><a href="gen_sctp.html#close-1">close/1</a></li>
<li title="connect-4"><a href="gen_sctp.html#connect-4">connect/4</a></li>
<li title="connect-5"><a href="gen_sctp.html#connect-5">connect/5</a></li>
<li title="connect_init-4"><a href="gen_sctp.html#connect_init-4">connect_init/4</a></li>
<li title="connect_init-5"><a href="gen_sctp.html#connect_init-5">connect_init/5</a></li>
<li title="controlling_process-2"><a href="gen_sctp.html#controlling_process-2">controlling_process/2</a></li>
<li title="eof-2"><a href="gen_sctp.html#eof-2">eof/2</a></li>
<li title="listen-2"><a href="gen_sctp.html#listen-2">listen/2</a></li>
<li title="open-0"><a href="gen_sctp.html#open-0">open/0</a></li>
<li title="open-1"><a href="gen_sctp.html#open-1">open/1</a></li>
<li title="open-2"><a href="gen_sctp.html#open-2">open/2</a></li>
<li title="peeloff-2"><a href="gen_sctp.html#peeloff-2">peeloff/2</a></li>
<li title="recv-1"><a href="gen_sctp.html#recv-1">recv/1</a></li>
<li title="recv-2"><a href="gen_sctp.html#recv-2">recv/2</a></li>
<li title="send-3"><a href="gen_sctp.html#send-3">send/3</a></li>
<li title="send-4"><a href="gen_sctp.html#send-4">send/4</a></li>
<li title="error_string-1"><a href="gen_sctp.html#error_string-1">error_string/1</a></li>
</ul>
</li>
<li id="no" title="global " expanded="false">global<ul>
<li><a href="global.html">
                  Top of manual page
                </a></li>
<li title="del_lock-1"><a href="global.html#del_lock-1">del_lock/1</a></li>
<li title="del_lock-2"><a href="global.html#del_lock-2">del_lock/2</a></li>
<li title="notify_all_name-3"><a href="global.html#notify_all_name-3">notify_all_name/3</a></li>
<li title="random_exit_name-3"><a href="global.html#random_exit_name-3">random_exit_name/3</a></li>
<li title="random_notify_name-3"><a href="global.html#random_notify_name-3">random_notify_name/3</a></li>
<li title="register_name-2"><a href="global.html#register_name-2">register_name/2</a></li>
<li title="register_name-3"><a href="global.html#register_name-3">register_name/3</a></li>
<li title="registered_names-0"><a href="global.html#registered_names-0">registered_names/0</a></li>
<li title="re_register_name-2"><a href="global.html#re_register_name-2">re_register_name/2</a></li>
<li title="re_register_name-3"><a href="global.html#re_register_name-3">re_register_name/3</a></li>
<li title="send-2"><a href="global.html#send-2">send/2</a></li>
<li title="set_lock-1"><a href="global.html#set_lock-1">set_lock/1</a></li>
<li title="set_lock-2"><a href="global.html#set_lock-2">set_lock/2</a></li>
<li title="set_lock-3"><a href="global.html#set_lock-3">set_lock/3</a></li>
<li title="sync-0"><a href="global.html#sync-0">sync/0</a></li>
<li title="trans-2"><a href="global.html#trans-2">trans/2</a></li>
<li title="trans-3"><a href="global.html#trans-3">trans/3</a></li>
<li title="trans-4"><a href="global.html#trans-4">trans/4</a></li>
<li title="unregister_name-1"><a href="global.html#unregister_name-1">unregister_name/1</a></li>
<li title="whereis_name-1"><a href="global.html#whereis_name-1">whereis_name/1</a></li>
</ul>
</li>
<li id="no" title="global_group " expanded="false">global_group<ul>
<li><a href="global_group.html">
                  Top of manual page
                </a></li>
<li title="global_groups-0"><a href="global_group.html#global_groups-0">global_groups/0</a></li>
<li title="info-0"><a href="global_group.html#info-0">info/0</a></li>
<li title="monitor_nodes-1"><a href="global_group.html#monitor_nodes-1">monitor_nodes/1</a></li>
<li title="own_nodes-0"><a href="global_group.html#own_nodes-0">own_nodes/0</a></li>
<li title="registered_names-1"><a href="global_group.html#registered_names-1">registered_names/1</a></li>
<li title="send-2"><a href="global_group.html#send-2">send/2</a></li>
<li title="send-3"><a href="global_group.html#send-3">send/3</a></li>
<li title="sync-0"><a href="global_group.html#sync-0">sync/0</a></li>
<li title="whereis_name-1"><a href="global_group.html#whereis_name-1">whereis_name/1</a></li>
<li title="whereis_name-2"><a href="global_group.html#whereis_name-2">whereis_name/2</a></li>
</ul>
</li>
<li id="no" title="heart " expanded="false">heart<ul>
<li><a href="heart.html">
                  Top of manual page
                </a></li>
<li title="set_cmd-1"><a href="heart.html#set_cmd-1">set_cmd/1</a></li>
<li title="clear_cmd-0"><a href="heart.html#clear_cmd-0">clear_cmd/0</a></li>
<li title="get_cmd-0"><a href="heart.html#get_cmd-0">get_cmd/0</a></li>
</ul>
</li>
<li id="no" title="inet " expanded="false">inet<ul>
<li><a href="inet.html">
                  Top of manual page
                </a></li>
<li title="close-1"><a href="inet.html#close-1">close/1</a></li>
<li title="get_rc-0"><a href="inet.html#get_rc-0">get_rc/0</a></li>
<li title="format_error-1"><a href="inet.html#format_error-1">format_error/1</a></li>
<li title="getaddr-2"><a href="inet.html#getaddr-2">getaddr/2</a></li>
<li title="getaddrs-2"><a href="inet.html#getaddrs-2">getaddrs/2</a></li>
<li title="gethostbyaddr-1"><a href="inet.html#gethostbyaddr-1">gethostbyaddr/1</a></li>
<li title="gethostbyname-1"><a href="inet.html#gethostbyname-1">gethostbyname/1</a></li>
<li title="gethostbyname-2"><a href="inet.html#gethostbyname-2">gethostbyname/2</a></li>
<li title="gethostname-0"><a href="inet.html#gethostname-0">gethostname/0</a></li>
<li title="getifaddrs-0"><a href="inet.html#getifaddrs-0">getifaddrs/0</a></li>
<li title="getopts-2"><a href="inet.html#getopts-2">getopts/2</a></li>
<li title="getstat-1"><a href="inet.html#getstat-1">getstat/1</a></li>
<li title="getstat-2"><a href="inet.html#getstat-2">getstat/2</a></li>
<li title="peername-1"><a href="inet.html#peername-1">peername/1</a></li>
<li title="port-1"><a href="inet.html#port-1">port/1</a></li>
<li title="sockname-1"><a href="inet.html#sockname-1">sockname/1</a></li>
<li title="setopts-2"><a href="inet.html#setopts-2">setopts/2</a></li>
</ul>
</li>
<li id="no" title="inet_res " expanded="false">inet_res<ul>
<li><a href="inet_res.html">
                  Top of manual page
                </a></li>
<li title="getbyname-2"><a href="inet_res.html#getbyname-2">getbyname/2</a></li>
<li title="getbyname-3"><a href="inet_res.html#getbyname-3">getbyname/3</a></li>
<li title="gethostbyaddr-1"><a href="inet_res.html#gethostbyaddr-1">gethostbyaddr/1</a></li>
<li title="gethostbyaddr-2"><a href="inet_res.html#gethostbyaddr-2">gethostbyaddr/2</a></li>
<li title="gethostbyname-1"><a href="inet_res.html#gethostbyname-1">gethostbyname/1</a></li>
<li title="gethostbyname-2"><a href="inet_res.html#gethostbyname-2">gethostbyname/2</a></li>
<li title="gethostbyname-3"><a href="inet_res.html#gethostbyname-3">gethostbyname/3</a></li>
<li title="lookup-3"><a href="inet_res.html#lookup-3">lookup/3</a></li>
<li title="lookup-4"><a href="inet_res.html#lookup-4">lookup/4</a></li>
<li title="lookup-5"><a href="inet_res.html#lookup-5">lookup/5</a></li>
<li title="resolve-3"><a href="inet_res.html#resolve-3">resolve/3</a></li>
<li title="resolve-4"><a href="inet_res.html#resolve-4">resolve/4</a></li>
<li title="resolve-5"><a href="inet_res.html#resolve-5">resolve/5</a></li>
<li title="nslookup-3"><a href="inet_res.html#nslookup-3">nslookup/3</a></li>
<li title="nslookup-4"><a href="inet_res.html#nslookup-4">nslookup/4</a></li>
<li title="nnslookup-4"><a href="inet_res.html#nnslookup-4">nnslookup/4</a></li>
<li title="nnslookup-5"><a href="inet_res.html#nnslookup-5">nnslookup/5</a></li>
</ul>
</li>
<li title="init"><a href="init.html">init</a></li>
<li id="no" title="net_adm " expanded="false">net_adm<ul>
<li><a href="net_adm.html">
                  Top of manual page
                </a></li>
<li title="dns_hostname-1"><a href="net_adm.html#dns_hostname-1">dns_hostname/1</a></li>
<li title="host_file-0"><a href="net_adm.html#host_file-0">host_file/0</a></li>
<li title="localhost-0"><a href="net_adm.html#localhost-0">localhost/0</a></li>
<li title="names-0"><a href="net_adm.html#names-0">names/0</a></li>
<li title="names-1"><a href="net_adm.html#names-1">names/1</a></li>
<li title="ping-1"><a href="net_adm.html#ping-1">ping/1</a></li>
<li title="world-0"><a href="net_adm.html#world-0">world/0</a></li>
<li title="world-1"><a href="net_adm.html#world-1">world/1</a></li>
<li title="world_list-1"><a href="net_adm.html#world_list-1">world_list/1</a></li>
<li title="world_list-2"><a href="net_adm.html#world_list-2">world_list/2</a></li>
</ul>
</li>
<li id="no" title="net_kernel " expanded="false">net_kernel<ul>
<li><a href="net_kernel.html">
                  Top of manual page
                </a></li>
<li title="allow-1"><a href="net_kernel.html#allow-1">allow/1</a></li>
<li title="connect_node-1"><a href="net_kernel.html#connect_node-1">connect_node/1</a></li>
<li title="monitor_nodes-1"><a href="net_kernel.html#monitor_nodes-1">monitor_nodes/1</a></li>
<li title="monitor_nodes-2"><a href="net_kernel.html#monitor_nodes-2">monitor_nodes/2</a></li>
<li title="get_net_ticktime-0"><a href="net_kernel.html#get_net_ticktime-0">get_net_ticktime/0</a></li>
<li title="set_net_ticktime-1"><a href="net_kernel.html#set_net_ticktime-1">set_net_ticktime/1</a></li>
<li title="set_net_ticktime-2"><a href="net_kernel.html#set_net_ticktime-2">set_net_ticktime/2</a></li>
<li title="start-1"><a href="net_kernel.html#start-1">start/1</a></li>
<li title="start-1"><a href="net_kernel.html#start-1">start/1</a></li>
<li title="start-1"><a href="net_kernel.html#start-1">start/1</a></li>
<li title="stop-0"><a href="net_kernel.html#stop-0">stop/0</a></li>
</ul>
</li>
<li id="no" title="os " expanded="false">os<ul>
<li><a href="os.html">
                  Top of manual page
                </a></li>
<li title="cmd-1"><a href="os.html#cmd-1">cmd/1</a></li>
<li title="find_executable-1"><a href="os.html#find_executable-1">find_executable/1</a></li>
<li title="find_executable-2"><a href="os.html#find_executable-2">find_executable/2</a></li>
<li title="getenv-0"><a href="os.html#getenv-0">getenv/0</a></li>
<li title="getenv-1"><a href="os.html#getenv-1">getenv/1</a></li>
<li title="getpid-0"><a href="os.html#getpid-0">getpid/0</a></li>
<li title="putenv-2"><a href="os.html#putenv-2">putenv/2</a></li>
<li title="timestamp-0"><a href="os.html#timestamp-0">timestamp/0</a></li>
<li title="type-0"><a href="os.html#type-0">type/0</a></li>
<li title="version-0"><a href="os.html#version-0">version/0</a></li>
</ul>
</li>
<li id="no" title="pg2 " expanded="false">pg2<ul>
<li><a href="pg2.html">
                  Top of manual page
                </a></li>
<li title="create-1"><a href="pg2.html#create-1">create/1</a></li>
<li title="delete-1"><a href="pg2.html#delete-1">delete/1</a></li>
<li title="get_closest_pid-1"><a href="pg2.html#get_closest_pid-1">get_closest_pid/1</a></li>
<li title="get_members-1"><a href="pg2.html#get_members-1">get_members/1</a></li>
<li title="get_local_members-1"><a href="pg2.html#get_local_members-1">get_local_members/1</a></li>
<li title="join-2"><a href="pg2.html#join-2">join/2</a></li>
<li title="leave-2"><a href="pg2.html#leave-2">leave/2</a></li>
<li title="which_groups-0"><a href="pg2.html#which_groups-0">which_groups/0</a></li>
<li title="start-0"><a href="pg2.html#start-0">start/0</a></li>
<li title="start_link-0"><a href="pg2.html#start_link-0">start_link/0</a></li>
</ul>
</li>
<li id="no" title="rpc " expanded="false">rpc<ul>
<li><a href="rpc.html">
                  Top of manual page
                </a></li>
<li title="call-4"><a href="rpc.html#call-4">call/4</a></li>
<li title="call-5"><a href="rpc.html#call-5">call/5</a></li>
<li title="block_call-4"><a href="rpc.html#block_call-4">block_call/4</a></li>
<li title="block_call-5"><a href="rpc.html#block_call-5">block_call/5</a></li>
<li title="async_call-4"><a href="rpc.html#async_call-4">async_call/4</a></li>
<li title="yield-1"><a href="rpc.html#yield-1">yield/1</a></li>
<li title="nb_yield-1"><a href="rpc.html#nb_yield-1">nb_yield/1</a></li>
<li title="nb_yield-2"><a href="rpc.html#nb_yield-2">nb_yield/2</a></li>
<li title="multicall-3"><a href="rpc.html#multicall-3">multicall/3</a></li>
<li title="multicall-4"><a href="rpc.html#multicall-4">multicall/4</a></li>
<li title="multicall-5"><a href="rpc.html#multicall-5">multicall/5</a></li>
<li title="cast-4"><a href="rpc.html#cast-4">cast/4</a></li>
<li title="eval_everywhere-3"><a href="rpc.html#eval_everywhere-3">eval_everywhere/3</a></li>
<li title="eval_everywhere-4"><a href="rpc.html#eval_everywhere-4">eval_everywhere/4</a></li>
<li title="abcast-2"><a href="rpc.html#abcast-2">abcast/2</a></li>
<li title="abcast-3"><a href="rpc.html#abcast-3">abcast/3</a></li>
<li title="sbcast-2"><a href="rpc.html#sbcast-2">sbcast/2</a></li>
<li title="sbcast-3"><a href="rpc.html#sbcast-3">sbcast/3</a></li>
<li title="server_call-4"><a href="rpc.html#server_call-4">server_call/4</a></li>
<li title="multi_server_call-2"><a href="rpc.html#multi_server_call-2">multi_server_call/2</a></li>
<li title="multi_server_call-3"><a href="rpc.html#multi_server_call-3">multi_server_call/3</a></li>
<li title="safe_multi_server_call-2"><a href="rpc.html#safe_multi_server_call-2">safe_multi_server_call/2</a></li>
<li title="safe_multi_server_call-3"><a href="rpc.html#safe_multi_server_call-3">safe_multi_server_call/3</a></li>
<li title="parallel_eval-1"><a href="rpc.html#parallel_eval-1">parallel_eval/1</a></li>
<li title="pmap-3"><a href="rpc.html#pmap-3">pmap/3</a></li>
<li title="pinfo-1"><a href="rpc.html#pinfo-1">pinfo/1</a></li>
<li title="pinfo-2"><a href="rpc.html#pinfo-2">pinfo/2</a></li>
</ul>
</li>
<li id="no" title="seq_trace " expanded="false">seq_trace<ul>
<li><a href="seq_trace.html">
                  Top of manual page
                </a></li>
<li title="set_token-1"><a href="seq_trace.html#set_token-1">set_token/1</a></li>
<li title="set_token-2"><a href="seq_trace.html#set_token-2">set_token/2</a></li>
<li title="get_token-0"><a href="seq_trace.html#get_token-0">get_token/0</a></li>
<li title="get_token-1"><a href="seq_trace.html#get_token-1">get_token/1</a></li>
<li title="print-1"><a href="seq_trace.html#print-1">print/1</a></li>
<li title="print-2"><a href="seq_trace.html#print-2">print/2</a></li>
<li title="reset_trace-0"><a href="seq_trace.html#reset_trace-0">reset_trace/0</a></li>
<li title="set_system_tracer-1"><a href="seq_trace.html#set_system_tracer-1">set_system_tracer/1</a></li>
<li title="get_system_tracer-0"><a href="seq_trace.html#get_system_tracer-0">get_system_tracer/0</a></li>
</ul>
</li>
<li title="user"><a href="user.html">user</a></li>
<li id="no" title="wrap_log_reader " expanded="false">wrap_log_reader<ul>
<li><a href="wrap_log_reader.html">
                  Top of manual page
                </a></li>
<li title="chunk-1"><a href="wrap_log_reader.html#chunk-1">chunk/1</a></li>
<li title="chunk-2"><a href="wrap_log_reader.html#chunk-2">chunk/2</a></li>
<li title="close-1"><a href="wrap_log_reader.html#close-1">close/1</a></li>
<li title="open-1"><a href="wrap_log_reader.html#open-1">open/1</a></li>
<li title="open-2"><a href="wrap_log_reader.html#open-2">open/2</a></li>
</ul>
</li>
<li title="zlib"><a href="zlib.html">zlib</a></li>
<li title="app"><a href="app.html">app</a></li>
<li title="config"><a href="config.html">config</a></li>
<li title="packages"><a href="packages.html">packages</a></li>
</ul>
</div></div>
<div id="content">
<div class="innertube">
<!-- refpage --><center><h1>code</h1></center>
  
  <h3>MODULE</h3>
<div class="REFBODY">code</div>
  <h3>MODULE SUMMARY</h3>
<div class="REFBODY">Erlang Code Server</div>
  <h3>DESCRIPTION</h3>
<div class="REFBODY"><p>
    <p>This module contains the interface to the Erlang
      <strong>code server</strong>, which deals with the loading of compiled
      code into a running Erlang runtime system.</p>
    <p>The runtime system can be started in either <strong>embedded</strong> or
      <strong>interactive</strong> mode. Which one is decided by the command
      line flag <span class="code">-mode</span>.</p>
    <div class="example"><pre>
% <span class="bold_code">erl -mode interactive</span></pre></div>
    <p>Default mode is <span class="code">interactive</span>.</p>
    <ul>
      <li>
        <p>In embedded mode, all code is loaded during system start-up
          according to the boot script. (Code can also be loaded later
          by explicitly ordering the code server to do so).</p>
      </li>
      <li>
        <p>In interactive mode, only some code is loaded during system
          startup-up, basically the modules needed by the runtime
          system itself. Other code is dynamically loaded when first
          referenced. When a call to a function in a certain module is
          made, and the module is not loaded, the code server searches
          for and tries to load the module.</p>
      </li>
    </ul>
    <p>To prevent accidentally reloading modules affecting the Erlang
      runtime system itself, the <span class="code">kernel</span>, <span class="code">stdlib</span> and
      <span class="code">compiler</span> directories are considered <strong>sticky</strong>. This
      means that the system issues a warning and rejects the request if
      a user tries to reload a module residing in any of them.
      The feature can be disabled by using the command line flag
      <span class="code">-nostick</span>.</p>
  </p></div>

  <h3><a name="id101794">Code Path</a></h3>
<div class="REFBODY">
    
    <p>In interactive mode, the code server maintains a search path --
      usually called the <strong>code path</strong> -- consisting of a list of
      directories, which it searches sequentially when trying to load a
      module.</p>
    <p>Initially, the code path consists of the current working
      directory and all Erlang object code directories under the library
      directory <span class="code">$OTPROOT/lib</span>, where <span class="code">$OTPROOT</span> is
      the installation directory of Erlang/OTP, <span class="code">code:root_dir()</span>.
      Directories can be named <span class="code">Name[-Vsn]</span> and the code server,
      by default, chooses the directory with the highest version number
      among those which have the same <span class="code">Name</span>. The <span class="code">-Vsn</span>
      suffix is optional. If an <span class="code">ebin</span> directory exists under
      <span class="code">Name[-Vsn]</span>, it is this directory which is added to
      the code path.</p>
    <p>The environment variable <span class="code">ERL_LIBS</span> (defined in the operating
      system) can be used to define additional library directories that
      will be handled in the same way as the standard OTP library
      directory described above, except that directories that do not
      have an <span class="code">ebin</span> directory will be ignored.</p>
    <p>All application directories found in the additional directories
      will appear before the standard OTP applications, except for the
      Kernel and STDLIB applications, which will be placed before any
      additional applications. In other words, modules found in any
      of the additional library directories will override modules with
      the same name in OTP, except for modules in Kernel and
      STDLIB.</p>
    <p>The environment variable <span class="code">ERL_LIBS</span> (if defined) should contain
      a colon-separated (for Unix-like systems) or semicolon-separated
      (for Windows) list of additional libraries.</p>
    <p>Example: On an Unix-like system, <span class="code">ERL_LIBS</span> could be set to
      <span class="code">/usr/local/jungerl:/home/some_user/my_erlang_lib</span>. (On Windows,
      use semi-colon as separator.)</p>
  </div>

  <h3><a name="id101888">Code Path Cache</a></h3>
<div class="REFBODY">
    
    <p>The code server incorporates a code path cache. The cache
      functionality is disabled by default. To activate it, start
      the emulator with the command line flag <span class="code">-code_path_cache</span>
      or call <span class="code">code:rehash()</span>. When the cache is created (or
      updated), the code server searches for modules in the code path
      directories. This may take some time if the the code path is long.
      After the cache creation, the time for loading modules in a large
      system (one with a large directory structure) is significantly
      reduced compared to having the cache disabled. The code server
      is able to look up the location of a module from the cache in
      constant time instead of having to search through the code path
      directories.</p>
    <p>Application resource files (<span class="code">.app</span> files) are also stored
      in the code path cache. This feature is used by the application
      controller (see
      <span class="bold_code"><a href="application.html">application(3)</a></span>) to load
      applications efficiently in large systems.</p>
    <p>Note that when the code path cache is created (or updated), any
      relative directory names in the code path are converted to
      absolute.</p>
  </div>

  <h3><a name="id101932">Loading of Code From Archive Files</a></h3>
<div class="REFBODY">
    

    <div class="warning">
<div class="label">Warning</div>
<div class="content"><p><p>The support for loading of code from archive files is
     experimental. The sole purpose of releasing it before it is ready
     is to obtain early feedback. The file format, semantics,
     interfaces etc. may be changed in a future release. The function
     <span class="code">lib_dir/2</span> and the flag <span class="code">-code_path_choice</span> are also
     experimental.</p></p></div>
</div>

    <p>In the current implementation, Erlang archives are <span class="code">ZIP</span>
     files with <span class="code">.ez</span> extension. Erlang archives may also be
     enclosed in <span class="code">escript</span> files whose file extension is arbitrary.</p>

    <p>Erlang archive files may contain entire Erlang applications or
     parts of applications. The structure in an archive file is the
     same as the directory structure for an application. If you for
     example would create an archive of <span class="code">mnesia-4.4.7</span>, the
     archive file must be named <span class="code">mnesia-4.4.7.ez</span> and it must
     contain a top directory with the name <span class="code">mnesia-4.4.7</span>. If the
     version part of the name is omitted, it must also be omitted in
     the archive. That is, a <span class="code">mnesia.ez</span> archive must contain a
     <span class="code">mnesia</span> top directory.</p>

    <p>An archive file for an application may for example be
     created like this:</p>

<div class="example"><pre>
   zip:create("mnesia-4.4.7.ez", 
              ["mnesia-4.4.7"], 
              [{cwd, code:lib_dir()},
               {compress, all},
               {uncompress,[".beam",".app"]}]).</pre></div>

    <p>Any file in the archive may be compressed, but in order to
     speed up the access of frequently read files, it may be a good
     idea to store <span class="code">beam</span> and <span class="code">app</span> files uncompressed in
     the archive.</p>

    <p>Normally the top directory of an application is located either
     in the library directory <span class="code">$OTPROOT/lib</span> or in a directory
     referred to by the environment variable <span class="code">ERL_LIBS</span>. At
     startup when the initial code path is computed, the code server
     will also look for archive files in these directories and
     possibly add <span class="code">ebin</span> directories in archives to the code path. The
     code path will then contain paths to directories that looks like
     <span class="code">$OTPROOT/lib/mnesia.ez/mnesia/ebin</span> or
     <span class="code">$OTPROOT/lib/mnesia-4.4.7.ez/mnesia-4.4.7/ebin</span>.</p>

    <p>The code server uses the module <span class="code">erl_prim_loader</span>
     (possibly via the <span class="code">erl_boot_server</span>) to read code files from
     archives. But the functions in <span class="code">erl_prim_loader</span> may also be
     used by other applications to read files from archives. For
     example, the call
     <span class="code">erl_prim_loader:list_dir( "/otp/root/lib/mnesia-4.4.7.ez/mnesia-4.4.7/examples/bench)"</span>
     would list the contents of a directory inside an archive.
     See <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','erts','erl_prim_loader.html');">erl_prim_loader(3)</a></span></p>.

    <p>An application archive file and a regular application directory
     may coexist. This may be useful when there is a need of having
     parts of the application as regular files. A typical case is the
     <span class="code">priv</span> directory which must reside as a regular directory in
     order to be able to dynamically link in drivers and start port
     programs. For other applications that do not have this need, the
     <span class="code">priv</span> directory may reside in the archive and the files
     under the <span class="code">priv</span> directory may be read via the
     <span class="code">erl_prim_loader</span>.</p>

    <p>At the time point when a directory is added to the code path as
     well as when the entire code path is (re)set, the code server
     will decide which subdirectories in an application that shall be
     read from the archive and which that shall be read as regular
     files. If directories are added or removed afterwards, the file
     access may fail if the code path is not updated (possibly to the
     same path as before in order to trigger the directory resolution
     update). For each directory on the second level (ebin, priv, src
     etc.) in the application archive, the code server will firstly
     choose the regular directory if it exists and secondly from the
     archive. The function
     <span class="code">code:lib_dir/2</span> returns the path to the subdirectory. For
     example <span class="code">code:lib_dir(megaco,ebin)</span> may return
     <span class="code">/otp/root/lib/megaco-3.9.1.1.ez/megaco-3.9.1.1/ebin</span> while
     <span class="code">code:lib_dir(megaco,priv)</span> may return
     <span class="code">/otp/root/lib/megaco-3.9.1.1/priv</span>.</p>

    <p>When an <span class="code">escript</span> file contains an archive, there are
     neither restrictions on the name of the <span class="code">escript</span> nor on how
     many applications that may be stored in the embedded
     archive. Single <span class="code">beam</span> files may also reside on the top
     level in the archive. At startup, both the top directory in the
     embedded archive as well as all (second level) <span class="code">ebin</span>
     directories in the embedded archive are added to the code path.
     See <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','erts','escript.html');">escript(1)</a></span></p>

    <p>When the choice of directories in the code path is
     <span class="code">strict</span>, the directory that ends up in the code path will
     be exactly the stated one. This means that if for example the
     directory <span class="code">$OTPROOT/lib/mnesia-4.4.7/ebin</span> is explicitly
     added to the code path, the code server will not load files from
     <span class="code">$OTPROOT/lib/mnesia-4.4.7.ez/mnesia-4.4.7/ebin</span> and vice
     versa. </p>

    <p>This behavior can be controlled via the command line flag
     <span class="code">-code_path_choice Choice</span>. If the flag is set to <span class="code">relaxed</span>,
     the code server will instead choose a suitable directory
     depending on the actual file structure. If there exists a regular
     application ebin directory,situation it will be chosen. But if it does
     not exist, the ebin directory in the archive is chosen if it
     exists. If neither of them exists the original directory will be
     chosen.</p>

    <p>The command line flag <span class="code">-code_path_choice Choice</span> does also
     affect how <span class="code">init</span> interprets the <span class="code">boot script</span>. The
     interpretation of the explicit code paths in the <span class="code">boot
     script</span> may be <span class="code">strict</span> or <span class="code">relaxed</span>. It is
     particular useful to set the flag to <span class="code">relaxed</span> when you want
     to elaborate with code loading from archives without editing the
     <span class="code">boot script</span>. The default is <span class="code">relaxed</span>. See <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','erts','init.html');">init(3)</a></span></p> </div>

  <h3><a name="id102223">Current and Old Code</a></h3>
<div class="REFBODY">

    
    <p>The code of a module can exists in two variants in a system:
      <strong>current code</strong> and <strong>old code</strong>. When a module is
      loaded into the system for the first time, the code of the module
      becomes 'current' and the global <strong>export table</strong> is updated
      with references to all functions exported from the module.</p>
    <p>If then a new instance of the module is loaded (perhaps because
      of the correction of an error), then the code of the previous
      instance becomes 'old', and all export entries referring to
      the previous instance are removed. After that the new instance is
      loaded as if it was loaded for the first time, as described above,
      and becomes 'current'.</p>
    <p>Both old and current code for a module are valid, and may even be
      evaluated concurrently. The difference is that exported functions
      in old code are unavailable. Hence there is no way to make a
      global call to an exported function in old code, but old code may
      still be evaluated because of processes lingering in it.</p>
    <p>If a third instance of the module is loaded, the code server will
      remove (purge) the old code and any processes lingering in it will
      be terminated. Then the third instance becomes 'current' and
      the previously current code becomes 'old'.</p>
    <p>For more information about old and current code, and how to
      make a process switch from old to current code, refer to
      <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','doc/reference_manual','code_loading.html');">Erlang Reference Manual</a></span>.</p>
  </div>

  <h3><a name="id102277">Argument Types and Invalid Arguments</a></h3>
<div class="REFBODY">
    

    <p>Generally, module and application names are atoms, while file and directory
    names are strings. For backward compatibility reasons, some functions accept
    both strings and atoms, but a future release will probably only allow
    the arguments that are documented.</p>

    <p>From the R12B release, functions in this module will generally fail with an
    exception if they are passed an incorrect type (for instance, an integer or a tuple
    where an atom was expected). An error tuple will be returned if type of argument
    was correct, but there was some other error (for instance, a non-existing directory
    given to <span class="code">set_path/1</span>.</p>
  </div>

  <h3>DATA TYPES</h3>
    <p>
      <span class="bold_code"><a name="type-load_ret">load_ret()</a> = {error, What :: <span class="bold_code"><a href="#type-load_error_rsn">load_error_rsn()</a></span>}<br>           | {module, Module :: module()}</span><br></p>
    <p>
      <span class="bold_code"><a name="type-load_error_rsn">load_error_rsn()</a> = badfile<br>                 | native_code<br>                 | nofile<br>                 | not_purged<br>                 | on_load<br>                 | sticky_directory</span><br></p>
  

  <h3>EXPORTS</h3>
    <p><a name="set_path-1"></a><span class="bold_code">set_path(Path) -&gt; true | {error, What}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Path = [Dir :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>]</span></div>
<div class="REFTYPES"><span class="bold_code">What = bad_directory | bad_path</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Sets the code path to the list of directories <span class="code">Path</span>.</p>
        <p>Returns <span class="code">true</span> if successful, or
          <span class="code">{error, bad_directory}</span> if any <span class="code">Dir</span> is not
          the name of a directory, or <span class="code">{error, bad_path}</span> if
          the argument is invalid.</p>
      </p></div>
    <p><a name="get_path-0"></a><span class="bold_code">get_path() -&gt; Path</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Path = [Dir :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>]</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns the code path</p>
      </p></div>
    <p><a name="add_path-1"></a><span class="bold_code">add_path(Dir) -&gt; add_path_ret()</span><br><a name="add_pathz-1"></a><span class="bold_code">add_pathz(Dir) -&gt; add_path_ret()</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Dir = <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span></div>
<div class="REFTYPES">
      <span class="bold_code">add_path_ret() = true | {error, bad_directory}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>Adds <span class="code">Dir</span> to the code path. The directory is added as
          the last directory in the new path. If <span class="code">Dir</span> already
          exists in the path, it is not added.</p>
        <p>Returns <span class="code">true</span> if successful, or
          <span class="code">{error, bad_directory}</span> if <span class="code">Dir</span> is not the name
          of a directory.</p>
      </p></div>
    <p><a name="add_patha-1"></a><span class="bold_code">add_patha(Dir) -&gt; add_path_ret()</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Dir = <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span></div>
<div class="REFTYPES">
      <span class="bold_code">add_path_ret() = true | {error, bad_directory}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>Adds <span class="code">Dir</span> to the beginning of the code path. If
          <span class="code">Dir</span> already exists, it is removed from the old
          position in the code path.</p>
        <p>Returns <span class="code">true</span> if successful, or
          <span class="code">{error, bad_directory}</span> if <span class="code">Dir</span> is not the name
          of a directory.</p>
      </p></div>
    <p><a name="add_paths-1"></a><span class="bold_code">add_paths(Dirs) -&gt; ok</span><br><a name="add_pathsz-1"></a><span class="bold_code">add_pathsz(Dirs) -&gt; ok</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Dirs = [Dir :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>]</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Adds the directories in <span class="code">Dirs</span> to the end of the code
          path. If a <span class="code">Dir</span> already exists, it is not added. This
          function always returns <span class="code">ok</span>, regardless of the validity
          of each individual <span class="code">Dir</span>.</p>
      </p></div>
    <p><a name="add_pathsa-1"></a><span class="bold_code">add_pathsa(Dirs) -&gt; ok</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Dirs = [Dir :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>]</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Adds the directories in <span class="code">Dirs</span> to the beginning of
          the code path. If a <span class="code">Dir</span> already exists, it is removed
          from the old position in the code path. This function always
          returns <span class="code">ok</span>, regardless of the validity of each
          individual <span class="code">Dir</span>.</p>
      </p></div>
    <p><a name="del_path-1"></a><span class="bold_code">del_path(NameOrDir) -&gt; boolean() | {error, What}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">NameOrDir = Name | Dir</span></div>
<div class="REFTYPES"><span class="bold_code">Name = atom()</span></div>
<div class="REFTYPES"><span class="bold_code">Dir = <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">What = bad_name</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Deletes a directory from the code path. The argument can be
          an atom <span class="code">Name</span>, in which case the directory with
          the name <span class="code">.../Name[-Vsn][/ebin]</span> is deleted from the code
          path. It is also possible to give the complete directory name
          <span class="code">Dir</span> as argument.</p>
        <p>Returns <span class="code">true</span> if successful, or <span class="code">false</span> if
          the directory is not found, or <span class="code">{error, bad_name}</span> if
          the argument is invalid.</p>
      </p></div>
    <p><a name="replace_path-2"></a><span class="bold_code">replace_path(Name, Dir) -&gt; true | {error, What}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Name = atom()</span></div>
<div class="REFTYPES"><span class="bold_code">Dir = <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">What = bad_directory | bad_name | {badarg, term()}</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>This function replaces an old occurrence of a directory
          named <span class="code">.../Name[-Vsn][/ebin]</span>, in the code path, with
          <span class="code">Dir</span>. If <span class="code">Name</span> does not exist, it adds the new
          directory <span class="code">Dir</span> last in the code path. The new directory
          must also be named <span class="code">.../Name[-Vsn][/ebin]</span>. This function
          should be used if a new version of the directory (library) is
          added to a running system.</p>
        <p>Returns <span class="code">true</span> if successful, or
          <span class="code">{error, bad_name}</span> if <span class="code">Name</span> is not found, or
          <span class="code">{error, bad_directory}</span> if <span class="code">Dir</span> does not exist, or
          <span class="code">{error, {badarg, [Name, Dir]}}</span> if <span class="code">Name</span> or
          <span class="code">Dir</span> is invalid.</p>
      </p></div>
    <p><a name="load_file-1"></a><span class="bold_code">load_file(Module) -&gt; <span class="bold_code"><a href="#type-load_ret">load_ret()</a></span></span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Module = module()</span></div>
<div class="REFTYPES">
      <span class="bold_code">load_ret() = {error, What :: <span class="bold_code"><a href="#type-load_error_rsn">load_error_rsn()</a></span>}<br>           | {module, Module :: module()}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>Tries to load the Erlang module <span class="code">Module</span>, using
          the code path. It looks for the object code file with an
          extension that corresponds to the Erlang machine used, for
          example <span class="code">Module.beam</span>. The loading fails if the module
          name found in the object code differs from the name
          <span class="code">Module</span>.
          <span class="bold_code"><a href="#load_binary-3">load_binary/3</a></span> must
          be used to load object code with a module name that is
          different from the file name.</p>
        <p>Returns <span class="code">{module, Module}</span> if successful, or
          <span class="code">{error, nofile}</span> if no object code is found, or
          <span class="code">{error, sticky_directory}</span> if the object code resides in
          a sticky directory. Also if the loading fails, an error tuple is
          returned. See
          <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','erts','erlang.html#load_module-2');">erlang:load_module/2</a></span>
          for possible values of <span class="code">What</span>.</p>
      </p></div>
    <p><a name="load_abs-1"></a><span class="bold_code">load_abs(Filename) -&gt; <span class="bold_code"><a href="#type-load_ret">load_ret()</a></span></span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Filename = <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span></div>
<div class="REFTYPES">
      <span class="bold_code">load_ret() = {error, What :: <span class="bold_code"><a href="#type-load_error_rsn">load_error_rsn()</a></span>}<br>           | {module, Module :: module()}</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">loaded_filename() = (Filename :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>)<br>                  | loaded_ret_atoms()</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">loaded_ret_atoms() = cover_compiled | preloaded</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>Does the same as <span class="code">load_file(Module)</span>, but
          <span class="code">Filename</span> is either an absolute file name, or a
          relative file name. The code path is not searched. It returns
          a value in the same way as
          <span class="bold_code"><a href="#load_file-1">load_file/1</a></span>. Note
          that <span class="code">Filename</span> should not contain the extension (for
          example <span class="code">".beam"</span>); <span class="code">load_abs/1</span> adds the correct
          extension itself.</p>
      </p></div>
    <p><a name="ensure_loaded-1"></a><span class="bold_code">ensure_loaded(Module) -&gt; {module, Module} | {error, What}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Module = module()</span></div>
<div class="REFTYPES"><span class="bold_code">What = embedded | badfile | native_code | nofile | on_load</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Tries to to load a module in the same way as
          <span class="bold_code"><a href="#load_file-1">load_file/1</a></span>,
	  unless the module is already loaded.
          In embedded mode, however, it does not load a module which is not
          already loaded, but returns <span class="code">{error, embedded}</span> instead.</p>
      </p></div>
    <p><a name="load_binary-3"></a><span class="bold_code">load_binary(Module, Filename, Binary) -&gt;<br>               {module, Module} | {error, What}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Module = module()</span></div>
<div class="REFTYPES"><span class="bold_code">Filename = loaded_filename()</span></div>
<div class="REFTYPES"><span class="bold_code">Binary = binary()</span></div>
<div class="REFTYPES"><span class="bold_code">What = badarg | <span class="bold_code"><a href="#type-load_error_rsn">load_error_rsn()</a></span></span></div>
<div class="REFTYPES">
      <span class="bold_code">loaded_filename() = (Filename :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>)<br>                  | loaded_ret_atoms()</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">loaded_ret_atoms() = cover_compiled | preloaded</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>This function can be used to load object code on remote
          Erlang nodes. The argument <span class="code">Binary</span> must contain
	  object code for <span class="code">Module</span>.
          <span class="code">Filename</span> is only used by the code server to keep a
          record of from which file the object code for <span class="code">Module</span>
          comes. Accordingly, <span class="code">Filename</span> is not opened and read by
          the code server.</p>
        <p>Returns <span class="code">{module, Module}</span> if successful, or
          <span class="code">{error, sticky_directory}</span> if the object code resides in
          a sticky directory, or <span class="code">{error, badarg}</span> if any argument
          is invalid. Also if the loading fails, an error tuple is
          returned. See
          <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','erts','erlang.html#load_module-2');">erlang:load_module/2</a></span>
          for possible values of <span class="code">What</span>.</p>
      </p></div>
    <p><a name="delete-1"></a><span class="bold_code">delete(Module) -&gt; boolean()</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Module = module()</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Removes the current code for <span class="code">Module</span>, that is,
          the current code for <span class="code">Module</span> is made old. This means
          that processes can continue to execute the code in the module,
          but that no external function calls can be made to it.</p>
        <p>Returns <span class="code">true</span> if successful, or <span class="code">false</span> if there
          is old code for <span class="code">Module</span> which must be purged first, or
          if <span class="code">Module</span> is not a (loaded) module.</p>
      </p></div>
    <p><a name="purge-1"></a><span class="bold_code">purge(Module) -&gt; boolean()</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Module = module()</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Purges the code for <span class="code">Module</span>, that is, removes code
          marked as old. If some processes still linger in the old code,
          these processes are killed before the code is removed.</p>
        <p>Returns <span class="code">true</span> if successful and any process needed to
          be killed, otherwise <span class="code">false</span>.</p>
      </p></div>
    <p><a name="soft_purge-1"></a><span class="bold_code">soft_purge(Module) -&gt; boolean()</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Module = module()</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Purges the code for <span class="code">Module</span>, that is, removes code
          marked as old, but only if no processes linger in it.</p>
        <p>Returns <span class="code">false</span> if the module could not be purged due
          to processes lingering in old code, otherwise <span class="code">true</span>.</p>
      </p></div>
    <p><a name="is_loaded-1"></a><span class="bold_code">is_loaded(Module) -&gt; {file, Loaded} | false</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Module = module()</span></div>
<div class="REFTYPES"><span class="bold_code">Loaded = loaded_filename()</span></div>
<div class="REFTYPES">
      <span class="bold_code">loaded_filename() = (Filename :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>)<br>                  | loaded_ret_atoms()</span><br>
</div>
<div class="REFBODY">
<span class="code">Filename</span> is an absolute filename</div>
<div class="REFTYPES">
      <span class="bold_code">loaded_ret_atoms() = cover_compiled | preloaded</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>Checks if <span class="code">Module</span> is loaded. If it is,
          <span class="code">{file, Loaded}</span> is returned, otherwise <span class="code">false</span>.</p>
        <p>Normally, <span class="code">Loaded</span> is the absolute file name
          <span class="code">Filename</span> from which the code was obtained. If the module
          is preloaded (see
          <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','sasl','script.html');">script(4)</a></span>),
          <span class="code">Loaded==preloaded</span>. If the module is Cover compiled (see
          <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','tools','cover.html');">cover(3)</a></span>),
          <span class="code">Loaded==cover_compiled</span>.</p>
      </p></div>
    <p><a name="all_loaded-0"></a><span class="bold_code">all_loaded() -&gt; [{Module, Loaded}]</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Module = module()</span></div>
<div class="REFTYPES"><span class="bold_code">Loaded = loaded_filename()</span></div>
<div class="REFTYPES">
      <span class="bold_code">loaded_filename() = (Filename :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>)<br>                  | loaded_ret_atoms()</span><br>
</div>
<div class="REFBODY">
<span class="code">Filename</span> is an absolute filename</div>
<div class="REFTYPES">
      <span class="bold_code">loaded_ret_atoms() = cover_compiled | preloaded</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns a list of tuples <span class="code">{Module, Loaded}</span> for all
          loaded modules. <span class="code">Loaded</span> is normally the absolute file
          name, as described for
          <span class="bold_code"><a href="#is_loaded-1">is_loaded/1</a></span>.</p>
      </p></div>
    <p><a name="which-1"></a><span class="bold_code">which(Module) -&gt; Which</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Module = module()</span></div>
<div class="REFTYPES"><span class="bold_code">Which = <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span> | loaded_ret_atoms() | non_existing</span></div>
<div class="REFTYPES">
      <span class="bold_code">loaded_ret_atoms() = cover_compiled | preloaded</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>If the module is not loaded, this function searches the code
          path for the first file which contains object code for
          <span class="code">Module</span> and returns the absolute file name. If
          the module is loaded, it returns the name of the file which
          contained the loaded object code. If the module is pre-loaded,
          <span class="code">preloaded</span> is returned. If the module is Cover compiled,
          <span class="code">cover_compiled</span> is returned. <span class="code">non_existing</span> is
          returned if the module cannot be found.</p>
      </p></div>
    <p><a name="get_object_code-1"></a><span class="bold_code">get_object_code(Module) -&gt; {Module, Binary, Filename} | error</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Module = module()</span></div>
<div class="REFTYPES"><span class="bold_code">Binary = binary()</span></div>
<div class="REFTYPES"><span class="bold_code">Filename = <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Searches the code path for the object code of the module
          <span class="code">Module</span>. It returns <span class="code">{Module, Binary, Filename}</span>
          if successful, and <span class="code">error</span> if not. <span class="code">Binary</span> is a
          binary data object which contains the object code for
          the module. This can be useful if code is to be loaded on a
          remote node in a distributed system. For example, loading
          module <span class="code">Module</span> on a node <span class="code">Node</span> is done as
          follows:</p>
        <div class="example"><pre>
...
{_Module, Binary, Filename} = code:get_object_code(Module),
rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
...</pre></div>
      </p></div>
    <p><a name="root_dir-0"></a><span class="bold_code">root_dir() -&gt; <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span><br></p>
<div class="REFBODY"><p>
        <p>Returns the root directory of Erlang/OTP, which is
          the directory where it is installed.</p>
        <div class="example"><pre>
&gt; <span class="bold_code">code:root_dir().</span>
"/usr/local/otp"</pre></div>
      </p></div>
    <p><a name="lib_dir-0"></a><span class="bold_code">lib_dir() -&gt; <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span><br></p>
<div class="REFBODY"><p>
        <p>Returns the library directory, <span class="code">$OTPROOT/lib</span>, where
          <span class="code">$OTPROOT</span> is the root directory of Erlang/OTP.</p>
        <div class="example"><pre>
&gt; <span class="bold_code">code:lib_dir().</span>
"/usr/local/otp/lib"</pre></div>
      </p></div>
    <p><a name="lib_dir-1"></a><span class="bold_code">lib_dir(Name) -&gt; <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span> | {error, bad_name}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Name = atom()</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>This function is mainly intended for finding out the path
          for the "library directory", the top directory, for an
          application <span class="code">Name</span> located under <span class="code">$OTPROOT/lib</span> or
          on a directory referred to via the <span class="code">ERL_LIBS</span>
          environment variable.</p>
        <p>If there is a regular directory called <span class="code">Name</span> or
          <span class="code">Name-Vsn</span> in the code path with an <span class="code">ebin</span>
          subdirectory, the path to this directory is returned (not
          the <span class="code">ebin</span> directory). If the directory refers to a
          directory in an archive, the archive name is stripped away
          before the path is returned.  For example, if the directory
          <span class="code">/usr/local/otp/lib/mnesia-4.2.2.ez/mnesia-4.2.2/ebin</span>
          is in the path, <span class="code">/usr/local/otp/lib/mnesia-4.2.2/ebin</span>
          will be returned. This means that the library directory for
          an application is the same, regardless of whether the
          application resides in an archive or not.</p>

        <div class="example"><pre>
&gt; <span class="bold_code">code:lib_dir(mnesia).</span>
"/usr/local/otp/lib/mnesia-4.2.2"</pre></div>
        <p>Returns <span class="code">{error, bad_name}</span> if <span class="code">Name</span>
	 is not the name of an application under <span class="code">$OTPROOT/lib</span> or
	 on a directory referred to via the <span class="code">ERL_LIBS</span>
         environment variable. Fails with an exception if <span class="code">Name</span>
         has the wrong type.</p>

	<div class="warning">
<div class="label">Warning</div>
<div class="content"><p><p>For backward compatibility, <span class="code">Name</span> is also allowed to
	be a string. That will probably change in a future release.</p></p></div>
</div>
      </p></div>
    <p><a name="lib_dir-2"></a><span class="bold_code">lib_dir(Name, SubDir) -&gt; <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span> | {error, bad_name}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Name = SubDir = atom()</span></div>
<div class="REFTYPES"><span class="bold_code"></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns the path to a subdirectory directly under the top
         directory of an application. Normally the subdirectories
         resides under the top directory for the application, but when
         applications at least partly resides in an archive the
         situation is different. Some of the subdirectories may reside
         as regular directories while other resides in an archive
         file. It is not checked if this directory really exists.</p>

        <div class="example"><pre>
&gt; <span class="bold_code">code:lib_dir(megaco, priv).</span>
"/usr/local/otp/lib/megaco-3.9.1.1/priv"</pre></div>

        <p>Fails with an exception if <span class="code">Name</span> or <span class="code">SubDir</span> has
        the wrong type.</p>
      </p></div>
    <p><a name="compiler_dir-0"></a><span class="bold_code">compiler_dir() -&gt; <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span><br></p>
<div class="REFBODY"><p>
        <p>Returns the compiler library directory. Equivalent to
          <span class="code">code:lib_dir(compiler)</span>.</p>
      </p></div>
    <p><a name="priv_dir-1"></a><span class="bold_code">priv_dir(Name) -&gt; <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span> | {error, bad_name}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Name = atom()</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns the path to the <span class="code">priv</span> directory in an
         application. Equivalent to <span class="code">code:lib_dir(Name, priv).</span>.</p>

	<div class="warning">
<div class="label">Warning</div>
<div class="content"><p><p>For backward compatibility, <span class="code">Name</span> is also allowed to
	be a string. That will probably change in a future release.</p></p></div>
</div>
      </p></div>
    <p><a name="objfile_extension-0"></a><span class="bold_code">objfile_extension() -&gt; nonempty_string()</span><br></p>
<div class="REFBODY"><p>
        <p>Returns the object code file extension that corresponds to
          the Erlang machine used, namely <span class="code">".beam"</span>.</p>
      </p></div>
    <p><a name="stick_dir-1"></a><span class="bold_code">stick_dir(Dir) -&gt; ok | error</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Dir = <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>This function marks <span class="code">Dir</span> as sticky.</p>
        <p>Returns <span class="code">ok</span> if successful or <span class="code">error</span> if not.</p>
      </p></div>
    <p><a name="unstick_dir-1"></a><span class="bold_code">unstick_dir(Dir) -&gt; ok | error</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Dir = <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>This function unsticks a directory which has been marked as
          sticky.</p>
        <p>Returns <span class="code">ok</span> if successful or <span class="code">error</span> if not.</p>
      </p></div>
    <p><a name="is_sticky-1"></a><span class="bold_code">is_sticky(Module) -&gt; boolean()</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Module = module()</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>This function returns <span class="code">true</span> if <span class="code">Module</span> is the
	name of a module that has been loaded from a sticky directory
	(or in other words: an attempt to reload the module will fail),
	or <span class="code">false</span> if <span class="code">Module</span> is not a loaded module or is
	not sticky.</p>
      </p></div>
    <p><a name="rehash-0"></a><span class="bold_code">rehash() -&gt; ok</span><br></p>
<div class="REFBODY"><p>
        <p>This function creates or rehashes the code path cache.</p>
      </p></div>
    <p><a name="where_is_file-1"></a><span class="bold_code">where_is_file(Filename) -&gt; non_existing | Absname</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Filename = Absname = <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code"></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Searches the code path for <span class="code">Filename</span>, a file of
          arbitrary type. If found, the full name is returned.
          <span class="code">non_existing</span> is returned if the file cannot be found.
          The function can be useful, for example, to locate
          application resource files. If the code path cache is used,
          the code server will efficiently read the full name from
          the cache, provided that <span class="code">Filename</span> is an object code
          file or an <span class="code">.app</span> file.</p>
      </p></div>
    <p><a name="clash-0"></a><span class="bold_code">clash() -&gt; ok</span><br></p>
<div class="REFBODY"><p>
        <p>Searches the entire code space for module names with
          identical names and writes a report to <span class="code">stdout</span>.</p>
      </p></div>
    <p><a name="is_module_native-1"><span class="bold_code">is_module_native(Module) -&gt; boolean() | undefined</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Module = module()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>This function returns <span class="code">true</span> if <span class="code">Module</span> is 
	name of a loaded module that has native code loaded, and 
	<span class="code">false</span> if <span class="code">Module</span> is loaded but does not have
	native. If <span class="code">Module</span> is not loaded, this function returns
	<span class="code">undefined</span>.</p>
      </p></div>
  
</div>
<div class="footer">
<hr>
<p>Copyright © 1997-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>