External modules are ScriptBasic extensions that are written in C and compiled to dynamic load libraries. ScriptBasic is capable loading these libraries and the functions implemented in the module become callable from Basic.
The line
DECLARE SUB basfun ALIAS "cfun" LIB "dlllib"
declares that the function basfun is implemented in an external library named dlllib. The name of the function that implements the library is called cfun. In your basic program you can call this function the same way as any other user-defined function or subroutine:
call basfun(arg1,arg2,...,argn)
or
a$ = basfun(arg1,arg2,...,argn)
The function name cfun is the name of the function as the dll or so object file exports it. The last string gives the name of object file. In the example above it is dlllib.
The dll object file name can be specified as an absolute file name or as a relative name. If the string specifies an absolute file name ScriptBasic tries to load the specified dll file. In this case the basic program has to specify the full path, the name of the file and the extension. If the name of the library file is a relative name it should not contain the path, or the extension. In this case ScriptBasic appends the default file extension for dynamic load libraries and tries to locate the files in the configured module libraries. The default file extension for dynamic load libraries and the module library directories are defined in the configuration file.
In case ScriptBasic can not fid the module in the module directories specified in the configuration file it tries under Windows to find the module dll in the same directory where the executable scriba.exe is and finally in the directory ..\modules relative to the directory of the executable scriba.exe. For example if the installation directory for ScriptBasic is
C:\ScriptBasic
the default location of the executable is
C:\ScriptBasic\bin\scriba.exe
In this case
C:\ScriptBasic\bin\dlllib.dll and
C:\ScriptBasic\modules\dlllib.dll
are also tried. This allows you to start ScriptBasic programs without tedious installation procedures, editing the registry or setting up complex configuration file.
ScriptBasic is NOT capable calling arbitrary external functions implemented in a dll file. The functions should be implemented according to the calling conventions and parameter passing methods that ScriptBasic supports. External modules usually come with the appropriate basic include file that you should include into your basic program. The included files usually contain all the external function declarations and your job is to use the functions.