📄 readme
字号:
This directory contains some examples of dynamically loaded modulesthat may be loaded via the `import' intrinsic function. If you chooseto build these modules, do so only AFTER installing the slang librarybecause the Makefile references the installed slang library location.The default installation location for the modules is in$(prefix)/lib/slang/modules.--------------------------------------------------------------------This directory contains some examples of dynamically loaded modulesthat may be loaded via the `import' intrinsic function: import ("NAME");This intrinsic function is available to applications that enable itvia a call to the `SLang_init_import' function. Of course, the OSmust provide support for dynamic linking.When a slang script contains a line such as import ("NAME"); or import ("NAME", "NAMESPACE"); slang requests that the operating system dynamically link to a sharedobject called NAME-module.so. Then the slang library will call thefunction `init_NAME_ns' that NAME-module.so must define. This functionmust have the prototype: int init_NAME_ns (char *namespace);and shall return 0 upon success, or -1 if an error occurred. Thenamespace argument corresponds to the second (option) parameter of theimport intrinsic. This means that the user wishes to import themodule into the specified namespace. To this end, the module mustcall one of the SLns_* functions to load intrinsics into a namespace.Optionally, the module may define a function called `deinit_NAME' thatwill be called by the interpreter to deinitialize the module. Thisfunction must have the prototype: void deinit_NAME (void);To ensure the correct prototypes for these functions, the moduleshould include the line: SLANG_MODULE(name);SLANG_MODULE is a macro that expands into function prototypes.See the examples in this directory for more information.To run these modules, use the slsh program in ../slsh/.slsh.c is a program that embeds the interpreter and may be used totest slang scripts. In fact, it may be used to create unix executablescripts via, e.g.,#! /usr/bin/env slshas the first line of the script. See ../slsh/scripts subdirectory forexamples of this approach.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -