# loadlib.c File Reference

`#include <stdlib.h>`
`#include <string.h>`
`#include "lua.h"`
`#include "lauxlib.h"`
`#include "lualib.h"`

## Defines
#define | loadlib_c
#define | LUA_LIB
#define | LUA_POF "luaopen_"
#define | LUA_OFSEP "_"
#define | LIBPREFIX "LOADLIB: "
#define | POF LUA_POF
#define | LIB_FAIL "open"
#define | ERRLIB 1
#define | ERRFUNC 2
#define | setprogdir(L) ((void)0)
#define | LIB_FAIL "absent"
#define | DLMSG "dynamic libraries not enabled; check your Lua installation"
#define | sentinel ((void *)&sentinel_)
#define | AUXMARK "\1"
## Functions
static void | ll_unloadlib (void *lib)
static void * | ll_load (lua_State *L, const char *path)
static lua_CFunction | ll_sym (lua_State *L, void *lib, const char *sym)
static void ** | ll_register (lua_State *L, const char *path)
static int | gctm (lua_State *L)
static int | ll_loadfunc (lua_State *L, const char *path, const char *sym)
static int | ll_loadlib (lua_State *L)
static int | readable (const char *filename)
static const char * | pushnexttemplate (lua_State *L, const char *path)
static const char * | findfile (lua_State *L, const char *name, const char *pname)
static void | loaderror (lua_State *L, const char *filename)
static int | loader_Lua (lua_State *L)
static const char * | mkfuncname (lua_State *L, const char *modname)
static int | loader_C (lua_State *L)
static int | loader_Croot (lua_State *L)
static int | loader_preload (lua_State *L)
static int | ll_require (lua_State *L)
static void | setfenv (lua_State *L)
static void | dooptions (lua_State *L, int n)
static void | modinit (lua_State *L, const char *modname)
static int | ll_module (lua_State *L)
static int | ll_seeall (lua_State *L)
static void | setpath (lua_State *L, const char *fieldname, const char *envname, const char *def)
LUALIB_API int | luaopen_package (lua_State *L)
## Variables
static const int | sentinel_ = 0
static const luaL_Reg | pk_funcs []
static const luaL_Reg | ll_funcs []
static const lua_CFunction | loaders []

## Define Documentation

#define AUXMARK "\1"

#define DLMSG "dynamic libraries not enabled; check your Lua installation"

#define ERRFUNC 2

#define ERRLIB 1

#define LIB_FAIL "absent"

#define LIB_FAIL "open"

#define LIBPREFIX "LOADLIB: "

#define loadlib_c

#define LUA_LIB

#define LUA_OFSEP "_"

#define LUA_POF "luaopen_"

#define POF LUA_POF

#define sentinel ((void *)&sentinel_)

#define setprogdir | ( | L |  | ) | ((void)0)

## Function Documentation

static void dooptions | ( | lua_State * | L,
|  | int | n |
| ) |  |  | `[static]`

static const char* findfile | ( | lua_State * | L,
|  | const char * | name,
|  | const char * | pname |
| ) |  |  | `[static]`

static int gctm | ( | lua_State * | L | ) | `[static]`

static void * ll_load | ( | lua_State * | L,
|  | const char * | path |
| ) |  |  | `[static]`

static int ll_loadfunc | ( | lua_State * | L,
|  | const char * | path,
|  | const char * | sym |
| ) |  |  | `[static]`

static int ll_loadlib | ( | lua_State * | L | ) | `[static]`

static int ll_module | ( | lua_State * | L | ) | `[static]`

static void** ll_register | ( | lua_State * | L,
|  | const char * | path |
| ) |  |  | `[static]`

static int ll_require | ( | lua_State * | L | ) | `[static]`

static int ll_seeall | ( | lua_State * | L | ) | `[static]`

static lua_CFunction ll_sym | ( | lua_State * | L,
|  | void * | lib,
|  | const char * | sym |
| ) |  |  | `[static]`

static void ll_unloadlib | ( | void * | lib | ) | `[static]`

static int loader_C | ( | lua_State * | L | ) | `[static]`

static int loader_Croot | ( | lua_State * | L | ) | `[static]`

static int loader_Lua | ( | lua_State * | L | ) | `[static]`

static int loader_preload | ( | lua_State * | L | ) | `[static]`

static void loaderror | ( | lua_State * | L,
|  | const char * | filename |
| ) |  |  | `[static]`

LUALIB_API int luaopen_package | ( | lua_State * | L | ) |

static const char* mkfuncname | ( | lua_State * | L,
|  | const char * | modname |
| ) |  |  | `[static]`

static void modinit | ( | lua_State * | L,
|  | const char * | modname |
| ) |  |  | `[static]`

static const char* pushnexttemplate | ( | lua_State * | L,
|  | const char * | path |
| ) |  |  | `[static]`

static int readable | ( | const char * | filename | ) | `[static]`

static void setfenv | ( | lua_State * | L | ) | `[static]`

static void setpath | ( | lua_State * | L,
|  | const char * | fieldname,
|  | const char * | envname,
|  | const char * | def |
| ) |  |  | `[static]`

## Variable Documentation

const luaL_Reg ll_funcs[]`[static]`

Initial value:

     {
      {"module", ll_module},
      {"require", ll_require},
      {NULL, NULL}
    }

const lua_CFunction loaders[]`[static]`

Initial value:

      {loader_preload, loader_Lua, loader_C, loader_Croot, NULL}

const luaL_Reg pk_funcs[]`[static]`

Initial value:

     {
      {"loadlib", ll_loadlib},
      {"seeall", ll_seeall},
      {NULL, NULL}
    }

const int sentinel_ = 0`[static]`