\hypertarget{qore_modules_mod_overview}{}\doxysection{Module Overview}\label{qore_modules_mod_overview}
Qore modules allow the Qore language to be extended at run-\/time.

To load a module at parse time (normally required for most modules), use the \mbox{\hyperlink{parse_directives_requires}{\%requires}} or \mbox{\hyperlink{parse_directives_try-module}{\%try-\/module}} parse directive. If the named feature is not already present in Qore, Qore will try to load the module from its list of module directories (module path). This list contains the following directories\+:~\newline

\begin{DoxyEnumerate}
\item directories listed in the environment variable {\ttfamily QORE\+\_\+\+MODULE\+\_\+\+DIR} (see \mbox{\hyperlink{environment_variables}{Environment Variables}})
\item {\ttfamily USER\+\_\+\+MODULE\+\_\+\+VER\+\_\+\+DIR} -\/ build variable set to directory where \mbox{\hyperlink{namespace_qore}{Qore}} user modules of the specific \mbox{\hyperlink{namespace_qore}{Qore}} version should be installed (ex\+: {\ttfamily /usr/share/qore-\/modules/0}.8.\+12)
\item {\ttfamily MODULE\+\_\+\+VER\+\_\+\+DIR} -\/ build variable set to directory where \mbox{\hyperlink{namespace_qore}{Qore}} binary modules of the specific \mbox{\hyperlink{namespace_qore}{Qore}} version should be installed (ex\+: {\ttfamily /usr/lib/x86\+\_\+64-\/linux-\/gnu/qore-\/modules/0}.8.\+12)
\item {\ttfamily USER\+\_\+\+MODULE\+\_\+\+DIR} -\/ build variable set to directory where user modules of external binary modules should be installed (ex\+: {\ttfamily /usr/share/qore-\/modules})
\item {\ttfamily MODULE\+\_\+\+DIR} -\/ build variable set to directory where external binary modules should be installed (ex\+: {\ttfamily /usr/lib/x86\+\_\+64-\/linux-\/gnu/qore-\/modules})
\item directories added using \mbox{\hyperlink{parse_directives_append-module-path}{\%append-\/module-\/path}}
\end{DoxyEnumerate}

Modules can also be loaded directly by using a path relative to the \mbox{\hyperlink{namespace_qore}{Qore}} script or module requiring them when using \mbox{\hyperlink{parse_directives_requires}{\%requires}} or \mbox{\hyperlink{parse_directives_try-module}{\%try-\/module}} parse directives\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\%requires ../../directory/Module.qm}

\end{DoxyCode}
 ~\newline
 Module implementation could be separated to multiple files and stored as a directory named with the same name as the module. To require them use \mbox{\hyperlink{parse_directives_requires}{\%requires Module\+Name}} without \char`\"{}.\+qm\char`\"{} extension. All files with the extenstion $\ast$qc, $\ast$ql (e.\+g. functions and classes) inside the directory will be automatically included at program parse time.

Examlpe of such separated module\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{ModuleName/}
\DoxyCodeLine{    |-\/ModuleName.qm         \textcolor{comment}{\# typical "{}qore"{} module file with the exception that implementation of classes and functions that it is used is stored separately}}
\DoxyCodeLine{    |-\/SomeModuleClass.qc}
\DoxyCodeLine{    |-\/SomeModuleFunction.ql}

\end{DoxyCode}
 ~\newline
 Use the load\+\_\+module() function to load Qore modules at run-\/time; however, note that any module providing parse support (classes, constants, functions, etc) must be loaded at parse time using the \mbox{\hyperlink{parse_directives_requires}{\%requires}} or \mbox{\hyperlink{parse_directives_try-module}{\%try-\/module}} parse directive.

From Qore 0.\+7.\+1 onwards, you can specify a comparison operator (one of \texorpdfstring{$<$}{<} \texorpdfstring{$<$}{<}=, =, \texorpdfstring{$>$}{>}=, or \texorpdfstring{$>$}{>}) and version information after the module name as well. Version numbers are compared via integer comparisons of each element, where elements are separated by a \textquotesingle{}.\textquotesingle{}. If one of the versions does not have as many elements as another, the missing elements are assumed to be \textquotesingle{}0\textquotesingle{} (i.\+e. version {\ttfamily \char`\"{}1.\+0\char`\"{}} compared with version {\ttfamily \char`\"{}1.\+0.\+1\char`\"{}} will be extended to {\ttfamily \char`\"{}1.\+0.\+0\char`\"{}}).

Also note that DBI drivers are loaded on demand by the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Qore\+::\+SQL\+::\+Datasource}} and \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_pool}{Qore\+::\+SQL\+::\+Datasource\+Pool}} classes.

There are two types of modules\+: \mbox{\hyperlink{qore_modules_binary_modules}{Binary Modules}} and \mbox{\hyperlink{qore_modules_user_modules}{User Modules}}.

At the time of writing this documentation, the following modules exist for Qore\+:

{\bfseries{Modules Provided With Qore}}  \tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{3}{|X[-1]}|}
\hline
{\bfseries{Type}} &{\bfseries{Module}} &{\bfseries{Description}}  \\\cline{1-3}
binary &\href{../../modules/astparser/html/index.html}{\texttt{ astparser}} &Provides a language parser API to Qore  \\\cline{1-3}
user &\href{../../modules/AwsRestClient/html/index.html}{\texttt{ Aws\+Rest\+Client}} &Provides a REST API for AWS services  \\\cline{1-3}
user &\href{../../modules/AwsRestClientDataProvider/html/index.html}{\texttt{ Aws\+Rest\+Client\+Data\+Provider}} &Provides a \href{../../modules/DataProvider/html/index.html}{\texttt{ data provider}} API for AWS REST servers  \\\cline{1-3}
user &\href{../../modules/BillwerkRestClient/html/index.html}{\texttt{ Billwerk\+Rest\+Client}} &providing APIs for communicating with \href{http://billwerk.com}{\texttt{ billwerk.\+com}}\textquotesingle{}s REST API  \\\cline{1-3}
user &\href{../../modules/BulkSqlUtil/html/index.html}{\texttt{ Bulk\+Sql\+Util}} &Provides APIs based on \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} for executing bulk DML operations  \\\cline{1-3}
user &\href{../../modules/CdsRestClient/html/index.html}{\texttt{ Cds\+Rest\+Client}} &providing APIs for communicating with the Microsoft Common Data Service REST API  \\\cline{1-3}
user &\href{../../modules/CdsRestDataProvider/html/index.html}{\texttt{ Cds\+Rest\+Data\+Provider}} &Provides a \href{../../modules/DataProvider/html/index.html}{\texttt{ data provider}} API for the Microsoft Common Data Service REST API  \\\cline{1-3}
user &\href{../../modules/ConnectionProvider/html/index.html}{\texttt{ Connection\+Provider}} &Provides an API for pluggable connection and URL providers  \\\cline{1-3}
user &\href{../../modules/CsvUtil/html/index.html}{\texttt{ Csv\+Util}} &Provides code to help parse CSV or other structured text files and also to easily generate such files  \\\cline{1-3}
user &\href{../../modules/DataProvider/html/index.html}{\texttt{ Data\+Provider}} &Provides a generic API for data providers  \\\cline{1-3}
user &\href{../../modules/DatasourceProvider/html/index.html}{\texttt{ Datasource\+Provider}} &Provides an API to translate datasource identifiers to datasource connection strings  \\\cline{1-3}
user &\href{../../modules/DbDataProvider/html/index.html}{\texttt{ Db\+Data\+Provider}} &Provides a \href{../../modules/DataProvider/html/index.html}{\texttt{ data provider}} API for databases  \\\cline{1-3}
user &\href{../../modules/DebugCmdLine/html/index.html}{\texttt{ Debug\+Cmd\+Line}} &Provides an API to develop command line debugger clients  \\\cline{1-3}
user &\href{../../modules/DebugLinenoiseCmdLine/html/index.html}{\texttt{ Debug\+Linenoise\+Cmd\+Line}} &Provides an API for command line debugger clients based on the \href{https://github.com/qorelanguage/module-linenoise}{\texttt{ linenoise}} module  \\\cline{1-3}
user &\href{../../modules/DebugProgramControl/html/index.html}{\texttt{ Debug\+Program\+Control}} &Provides an API to develop debug server  \\\cline{1-3}
user &\href{../../modules/DebugHandler/html/index.html}{\texttt{ Debug\+Handler}} &Provides a websocket for debug server  \\\cline{1-3}
user &\href{../../modules/DebugUtil/html/index.html}{\texttt{ Debug\+Util}} &Provides a general stuff for debugger  \\\cline{1-3}
user &\href{../../modules/FileDataProvider/html/index.html}{\texttt{ File\+Data\+Provider}} &Provides a \href{../../modules/DataProvider/html/index.html}{\texttt{ data provider}} API for the local filesystem  \\\cline{1-3}
user &\href{../../modules/FileLocationHandler/html/index.html}{\texttt{ File\+Location\+Handler}} &Provides an API for retrieving file data based on a URL-\/like location string  \\\cline{1-3}
user &\href{../../modules/FilePoller/html/index.html}{\texttt{ File\+Poller}} &Provides an API for polling files on the filesystem  \\\cline{1-3}
user &\href{../../modules/FixedLengthUtil/html/index.html}{\texttt{ Fixed\+Length\+Util}} &Provides code to help parse data in format of fixed length lines records  \\\cline{1-3}
user &\href{../../modules/FreetdsSqlUtil/html/index.html}{\texttt{ Freetds\+Sql\+Util}} &Provides a high-\/level DB-\/independent API for working with MS SQL Server and Sybase database objects; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with the \href{https://github.com/qorelanguage/module-sybase}{\texttt{ freetds DBI driver}} for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/FsUtil/html/index.html}{\texttt{ Fs\+Util}} &Provides a high level API for working with the filesystem  \\\cline{1-3}
user &\href{../../modules/FtpClientDataProvider/html/index.html}{\texttt{ Ftp\+Client\+Data\+Provider}} &Provides a \href{../../modules/DataProvider/html/index.html}{\texttt{ data provider}} API for the FTP protocol  \\\cline{1-3}
user &\href{../../modules/FtpPoller/html/index.html}{\texttt{ Ftp\+Poller}} &Provides an API for polling files from a remote directory with the FTP protocol  \\\cline{1-3}
user &\href{../../modules/FtpPollerUtil/html/index.html}{\texttt{ Ftp\+Poller\+Util}} &Provides definitions for the \href{../../modules/FtpPoller/html/index.html}{\texttt{ Ftp\+Poller}} module  \\\cline{1-3}
user &\href{../../modules/HttpClientDataProvider/html/index.html}{\texttt{ Http\+Client\+Data\+Provider}} &Provides a \href{../../modules/DataProvider/html/index.html}{\texttt{ data provider}} API for HTTP servers  \\\cline{1-3}
user &\href{../../modules/HttpServer/html/index.html}{\texttt{ Http\+Server}} &Provides a multi-\/threaded HTTP server and request handler APIs; provides the infrastructure for server-\/side HTTP services  \\\cline{1-3}
user &\href{../../modules/HttpServerUtil/html/index.html}{\texttt{ Http\+Server\+Util}} &Provides base definitions for handler classes integrating with the \href{../../modules/HttpServer/html/index.html}{\texttt{ Http\+Server}} module  \\\cline{1-3}
user &\href{../../modules/JdbcFirebirdSqlUtil/html/index.html}{\texttt{ Jdbc\+Firebird\+Sql\+Util}} &Provides a high-\/level DB-\/independent API for working with Firebird database objects using \href{../../modules/XdbcFirebirdSqlUtilBase/html/index.html}{\texttt{ Xdbc\+Firebird\+Sql\+Util\+Base}} and the binary \href{https://github.com/qorelanguage/module-jni}{\texttt{ jni}} module providing the {\ttfamily jdbc} DBI driver; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with Firebird databases for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/JdbcMicrosoftSqlUtil/html/index.html}{\texttt{ Jdbc\+Microsoft\+Sql\+Util}} &Provides a high-\/level DB-\/independent API for working with MS SQL Server database objects through the {\ttfamily jdbc} driver; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with MS SQL Server databases for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/JdbcOracleSqlUtil/html/index.html}{\texttt{ Jdbc\+Oracle\+Sql\+Util}} &Provides a high-\/level DB-\/independent API for working with Oracle database objects through the {\ttfamily jdbc} driver; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with Oracle databases for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/JdbcPostgresqlSqlUtil/html/index.html}{\texttt{ Jdbc\+Postgresql\+Sql\+Util}} &Provides a high-\/level DB-\/independent API for working with Postgre\+SQL database objects; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with Postgre\+SQL databases with the {\ttfamily jdbc} driver for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/Logger/html/index.html}{\texttt{ Logger}} &Provides a flexible logging API (aka \char`\"{}log4q\char`\"{})  \\\cline{1-3}
user &\href{../../modules/MailMessage/html/index.html}{\texttt{ Mail\+Message}} &Provides supporting classes for the \href{../../modules/Pop3Client/html/index.html}{\texttt{ Pop3\+Client}} and \href{../../modules/SmtpClient/html/index.html}{\texttt{ Smtp\+Client}} modules; mail message serialization and deserialization, attachment handling  \\\cline{1-3}
user &\href{../../modules/Mapper/html/index.html}{\texttt{ Mapper}} &Provides data mapping classes and iterators  \\\cline{1-3}
user &\href{../../modules/MapperUtil/html/index.html}{\texttt{ Mapper\+Util}} &Provides common definitions for data mapping APIs  \\\cline{1-3}
user &\href{../../modules/Mime/html/index.html}{\texttt{ Mime}} &Provides MIME definitions and functions; MIME type lookups, MIME encoding and decoding functions, MIME multipart handling, etc  \\\cline{1-3}
user &\href{../../modules/MssqlSqlUtilBase/html/index.html}{\texttt{ Mssql\+Sql\+Util\+Base}} &Provides a high-\/level DB-\/independent API for working with MS SQL Serfer database objects; this module supports \href{../../modules/FreetdsSqlUtil/html/index.html}{\texttt{ Freetds\+Sql\+Util}} and \href{../../modules/JdbcMicrosoftSqlUtil/html/index.html}{\texttt{ Jdbc\+Microsoft\+Sql\+Util}}; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with MS SQL Server databases for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/MysqlSqlUtil/html/index.html}{\texttt{ Mysql\+Sql\+Util}} &Provides a high-\/level DB-\/independent API for working with My\+SQL database objects; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with My\+SQL databases for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/OdbcFirebirdSqlUtil/html/index.html}{\texttt{ Odbc\+Firebird\+Sql\+Util}} &Provides a high-\/level DB-\/independent API for working with Firebird database objects using \href{../../modules/XdbcFirebirdSqlUtilBase/html/index.html}{\texttt{ Xdbc\+Firebird\+Sql\+Util\+Base}} and the binary \href{https://github.com/qorelanguage/module-odbc}{\texttt{ odbc}} module; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with Firebird databases for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/OracleSqlUtil/html/index.html}{\texttt{ Oracle\+Sql\+Util}} &Provides a high-\/level DB-\/independent API for working with Oracle database objects; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with Oracle databases for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/OracleSqlUtilBase/html/index.html}{\texttt{ Oracle\+Sql\+Util\+Base}} &Provides a high-\/level DB-\/independent API for working with Oracle database objects; this module supports \href{../../modules/OracleSqlUtil/html/index.html}{\texttt{ Oracle\+Sql\+Util}} and \href{../../modules/JdbcOracleSqlUtil/html/index.html}{\texttt{ Jdbc\+Oracle\+Sql\+Util}}; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with Oracle databases for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/Pop3Client/html/index.html}{\texttt{ Pop3\+Client}} &Provides POP3 client functionality; provides an API to retrieve email messages from a POP3 server  \\\cline{1-3}
user &\href{../../modules/PgsqlSqlUtilBase/html/index.html}{\texttt{ Pgsql\+Sql\+Util\+Base}} &Provides a high-\/level DB-\/independent API for working with Postgre\+SQL database objects; this module supports \href{../../modules/PgsqlSqlUtil/html/index.html}{\texttt{ Pgsql\+Sql\+Util}} and \href{../../modules/JdbcPostgresqlSqlUtil/html/index.html}{\texttt{ Jdbc\+Postgresql\+Sql\+Util}}; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with Postgre\+SQL databases for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/PgsqlSqlUtil/html/index.html}{\texttt{ Pgsql\+Sql\+Util}} &Provides a high-\/level DB-\/independent API for working with Postgre\+SQL database objects; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with Postgre\+SQL databases for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/Qdx/html/index.html}{\texttt{ Qdx}} &Provides support for documentation generation with doxygen from Qore sources  \\\cline{1-3}
user &\href{../../modules/Qorize/html/index.html}{\texttt{ Qorize}} &Provides basic support for automatically-\/generating Qore code from data  \\\cline{1-3}
user &\href{../../modules/QUnit/html/index.html}{\texttt{ QUnit}} &Provides an API for defining and executing tests and reporting results in various formats  \\\cline{1-3}
binary &\href{../../modules/reflection/html/index.html}{\texttt{ reflection}} &Provides a reflection API to Qore  \\\cline{1-3}
user &\href{../../modules/RestClient/html/index.html}{\texttt{ Rest\+Client}} &Provides a simple API for communicating with HTTP servers implementing \href{http://en.wikipedia.org/wiki/Representational_state_transfer}{\texttt{ REST}} services  \\\cline{1-3}
user &\href{../../modules/RestClientDataProvider/html/index.html}{\texttt{ Rest\+Client\+Data\+Provider}} &Provides a \href{../../modules/DataProvider/html/index.html}{\texttt{ data provider}} API for REST servers  \\\cline{1-3}
user &\href{../../modules/RestHandler/html/index.html}{\texttt{ Rest\+Handler}} &Provides an easy to use interface to the Qore \href{../../modules/HttpServer/html/index.html}{\texttt{ Http\+Server}} module for implementing server-\/side \href{http://en.wikipedia.org/wiki/Representational_state_transfer}{\texttt{ REST}} services  \\\cline{1-3}
user &\href{../../modules/RestSchemaValidator/html/index.html}{\texttt{ Rest\+Schema\+Validator}} &Provides a \href{https://en.wikipedia.org/wiki/Representational_state_transfer}{\texttt{ REST}} schema validation API  \\\cline{1-3}
user &\href{../../modules/SalesforceRestClient/html/index.html}{\texttt{ Salesforce\+Rest\+Client}} &Provides an API for communicating with \href{https://www.salesforce.com}{\texttt{ Salesforce.\+com}} \href{http://en.wikipedia.org/wiki/Representational_state_transfer}{\texttt{ REST}} services (extends and reexports functionality provided by the \href{../../modules/RestClient/html/index.html}{\texttt{ Rest\+Client}} module)  \\\cline{1-3}
user &\href{../../modules/SalesforceRestDataProvider/html/index.html}{\texttt{ Salesforce\+Rest\+Data\+Provider}} &Provides a \href{../../modules/DataProvider/html/index.html}{\texttt{ data provider}} API for Salesforce REST connections  \\\cline{1-3}
user &\href{../../modules/Sap4HanaRestClient/html/index.html}{\texttt{ Sap4\+Hana\+Rest\+Client}} &providing APIs for communicating with \href{https://sap.com}{\texttt{ SAP S/4 Hana}}\textquotesingle{}s REST API  \\\cline{1-3}
user &\href{../../modules/Schema/html/index.html}{\texttt{ Schema}} &Provides automatic schema management functionality as a meta-\/layer for \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}}\textquotesingle{}s medium and low-\/level schema management functionality  \\\cline{1-3}
user &\href{../../modules/ServiceNowRestClient/html/index.html}{\texttt{ Service\+Now\+Rest\+Client}} &providing APIs for communicating with the Service\+Now REST API  \\\cline{1-3}
user &\href{../../modules/ServiceNowRestDataProvider/html/index.html}{\texttt{ Service\+Now\+Rest\+Data\+Provider}} &Provides a \href{../../modules/DataProvider/html/index.html}{\texttt{ data provider}} API for the Service\+Now REST API  \\\cline{1-3}
user &\href{../../modules/SewioRestClient/html/index.html}{\texttt{ Sewio\+Rest\+Client}} &providing APIs for communicating with \href{http://www.sewio.net}{\texttt{ Sewio.\+net}}\textquotesingle{}s RTLS Studio REST API  \\\cline{1-3}
user &\href{../../modules/SewioWebSocketClient/html/index.html}{\texttt{ Sewio\+Web\+Socket\+Client}} &providing APIs for communicating with \href{http://www.sewio.net}{\texttt{ Sewio.\+net}}\textquotesingle{}s RTLS Studio Web\+Socket API  \\\cline{1-3}
user &\href{../../modules/SmtpClient/html/index.html}{\texttt{ Smtp\+Client}} &Provides SMTP client functionality; provides an API for sending emails via an SMTP server  \\\cline{1-3}
user &\href{../../modules/Sqlite3SqlUtil/html/index.html}{\texttt{ Sqlite3\+Sql\+Util}} &Provides a high-\/level DB-\/independent API for working with SQLite3 database objects; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with SQLite3 databases for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} &Provides a high-\/level DB-\/independent API for working with databases; for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/Swagger/html/index.html}{\texttt{ Swagger}} &Provides a \href{https://swagger.io/}{\texttt{ Swagger 2.\+0 REST API validation API}}  \\\cline{1-3}
user &\href{../../modules/SwaggerDataProvider/html/index.html}{\texttt{ Swagger\+Data\+Provider}} &Provides a \href{../../modules/DataProvider/html/index.html}{\texttt{ data provider}} API for \href{https://swagger.io/}{\texttt{ Swagger}} schemas  \\\cline{1-3}
user &\href{../../modules/TableMapper/html/index.html}{\texttt{ Table\+Mapper}} &Provides a data mapping functionality and iterator support using \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} and \href{../../modules/Mapper/html/index.html}{\texttt{ Mapper}} to map arbitrary data to an SQL table target  \\\cline{1-3}
user &\href{../../modules/TelnetClient/html/index.html}{\texttt{ Telnet\+Client}} &Provides Telnet client functionality  \\\cline{1-3}
user &\href{../../modules/TextWrap/html/index.html}{\texttt{ Text\+Wrap}} &Provides text wrapping and filling functionality  \\\cline{1-3}
user &\href{../../modules/Util/html/index.html}{\texttt{ Util}} &Provides a some miscellaneous generally useful routines; often used by other user modules for example  \\\cline{1-3}
user &\href{../../modules/WebSocketClient/html/index.html}{\texttt{ Web\+Socket\+Client}} &Provides an event-\/driven client API for connecting to Web\+Socket servers  \\\cline{1-3}
user &\href{../../modules/WebSocketHandler/html/index.html}{\texttt{ Web\+Socket\+Handler}} &Provides an interface to the Qore \href{../../modules/HttpServer/html/index.html}{\texttt{ Http\+Server}} module for implementing server-\/side Web\+Socket services  \\\cline{1-3}
user &\href{../../modules/WebSocketUtil/html/index.html}{\texttt{ Web\+Socket\+Util}} &Provides common client and server code for implementing Web\+Socket protocol services in Qore  \\\cline{1-3}
user &\href{../../modules/WebUtil/html/index.html}{\texttt{ Web\+Util}} &Provides higher-\/level classes for implementing more complex web services in Qore; works with the \href{../../modules/HttpServer/html/index.html}{\texttt{ Http\+Server}} module  \\\cline{1-3}
user &\href{../../modules/XdbcFirebirdSqlUtilBase/html/index.html}{\texttt{ Xdbc\+Firebird\+Sql\+Util\+Base}} &Provides a high-\/level DB-\/independent API for working with Firebird database objects; this module supports \href{../../modules/JdbcFirebirdSqlUtil/html/index.html}{\texttt{ Jdbc\+Firebird\+Sql\+Util}} and \href{../../modules/OdbcFirebirdSqlUtil/html/index.html}{\texttt{ Odbc\+Firebird\+Sql\+Util}}; loaded automatically by the \href{../../modules/SqlUtil/html/index.html}{\texttt{ Sql\+Util}} module when working with Firebird databases for automated schema management, programmatic DB access, schema and data synchronization, and more  \\\cline{1-3}
user &\href{../../modules/ZeyosRestClient/html/index.html}{\texttt{ Zeyos\+Rest\+Client}} &providing APIs for communicating with \href{http://www.zeyos.com}{\texttt{ Zeyos.\+com}}\textquotesingle{}s REST API  \\\cline{1-3}
\end{longtabu}


{\bfseries{Modules Provided Separately}}  \tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{3}{|X[-1]}|}
\hline
{\bfseries{Type}} &{\bfseries{Module}} &{\bfseries{Description}}  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-sybase}{\texttt{ freetds}} &Provides a Free\+TDS-\/based DBI driver for communicating with Sybase and MS SQL Server databases  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-fsevent}{\texttt{ fsevent}} &Provides an event-\/driven filesystem event API  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-jni}{\texttt{ jni}} &Provides access to Java APIs in Qore  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-json}{\texttt{ json}} &Provides JSON and JSON-\/\+RPC client functionality, also provides the following user modules\+:~\newline
-\/ \href{http://www.qore.org/manual/modules/json/current/JsonRpcHandler/html/index.html}{\texttt{ Json\+Rpc\+Handler}}\+: provides infrastructure for implementing JSON-\/\+RPC server-\/side services using the \href{../../modules/HttpServer/html/index.html}{\texttt{ Http\+Server}} module  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-linenoise}{\texttt{ linenoise}} &Provides a readline-\/like API to Qore under a permissive license  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-msgpack}{\texttt{ msgpack}} &Provides APIs for efficient data serialization in Qore using the \href{https://msgpack.org/index.html}{\texttt{ Message\+Pack}} format  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-mysql}{\texttt{ mysql}} &Provides a My\+SQL / Maria\+DB / Percona DBI driver  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-odbc}{\texttt{ odbc}} &Provides an ODBC DBI driver to Qore  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-oracle}{\texttt{ oracle}} &Provides an Oracle DBI driver, providing many advanced features such as support for named types and collections, advanced queuing, etc, also provides the following user modules\+:~\newline
-\/ \href{http://docs.qore.org/modules/oracle/current/OracleExtensions/html/index.html}{\texttt{ Oracle\+Extensions}}\+: provides infrastructure for SQL tracing  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-openldap}{\texttt{ openldap}} &Provides an Open\+LDAP API to Qore  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-pgsql}{\texttt{ pgsql}} &Provides a Postgre\+SQL DBI driver  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-process}{\texttt{ process}} &Provides an API for controlling external processes  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-sqlite3}{\texttt{ sqlite3}} &Provides an SQLite3 DBI driver  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-ssh2}{\texttt{ ssh2}} &Provides SSH2 and SFTP functionality, also provides the following user module\+:~\newline
-\/ \href{http://docs.qore.org/modules/ssh2/current/SftpPoller/html/index.html}{\texttt{ Sftp\+Poller}}\+: provides event-\/driven support for polling an SFTP server for new data  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-sybase}{\texttt{ sybase}} &Provides a Sybase DBI driver  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-sysconf}{\texttt{ sysconf}} &Provides sysconf, pathconf, and confstr APIs  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-tibae}{\texttt{ tibae}} &Provides TIBCO Active\+Enterprise(\+TM) (TIBCO, Inc) functionality  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-tibrv}{\texttt{ tibrv}} &Provides TIBCO Rendezvous(\+R) (TIBCO, Inc) functionality  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-uuid}{\texttt{ uuid}} &Provices an API for generating UUIDs  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-xml}{\texttt{ xml}} &Provides XML (SAX and DOM parsers), XPath, XML-\/\+RPC, SOAP client and server, etc functionality, also provides the following user modules\+:~\newline
 -\/ \href{http://docs.qore.org/modules/xml/current/SoapClient/html/index.html}{\texttt{ Soap\+Client}}\+: provides an easy to use API for making requests to SOAP servers~\newline
 -\/ \href{http://docs.qore.org/modules/xml/current/SalesforceSoapClient/html/index.html}{\texttt{ Salesforce\+Soap\+Client}}\+: provides an easy to use API for making requests to Salesforce.\+com SOAP servers~\newline
 -\/ \href{http://docs.qore.org/modules/xml/current/SoapHandler/html/index.html}{\texttt{ Soap\+Handler}}\+: provides infrastructure for implementing SOAP server-\/side services using the \href{../../modules/HttpServer/html/index.html}{\texttt{ Http\+Server}} module~\newline
 -\/ \href{http://docs.qore.org/modules/xml/current/WSDL/html/index.html}{\texttt{ WSDL}}\+: provides underlying web service/\+WSDL support for the \href{http://docs.qore.org/modules/xml/current/SoapClient/html/index.html}{\texttt{ Soap\+Client}} and \href{http://docs.qore.org/modules/xml/current/SoapHandler/html/index.html}{\texttt{ Soap\+Handler}} modules~\newline
 -\/ \href{http://docs.qore.org/modules/xml/current/WebDavHandler/html/index.html}{\texttt{ Web\+Dav\+Handler}}\+: provides an API for serving Web\+DAV content using the \href{../../modules/HttpServer/html/index.html}{\texttt{ Http\+Server}} module~\newline
 -\/ \href{http://docs.qore.org/modules/xml/current/XmlRpcHandler/html/index.html}{\texttt{ Xml\+Rpc\+Handler}}\+: provides infrastructure for implementing XML-\/\+RPC server-\/side services using the \href{../../modules/HttpServer/html/index.html}{\texttt{ Http\+Server}} module  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-xmlsec}{\texttt{ xmlsec}} &Provides xmldsig and xmlenc functionality  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-yaml}{\texttt{ yaml}} &Provides YAML functionality, also provides the following user modules\+:~\newline
-\/ \href{http://docs.qore.org/modules/yaml/current/DataStreamClient/html/index.html}{\texttt{ Data\+Stream\+Client}}\+: provides a Data\+Stream client API extending the Rest\+Client~\newline
-\/ \href{http://docs.qore.org/modules/yaml/current/DataStreamRequestHandler/html/index.html}{\texttt{ Data\+Stream\+Request\+Handler}}\+: provides a Data\+Stream server-\/side handler API extending the Rest\+Handler~\newline
-\/ \href{http://docs.qore.org/modules/yaml/current/DataStreamUtil/html/index.html}{\texttt{ Data\+Stream\+Util}}\+: provides underlying Data\+Stream client and server protocol support~\newline
-\/ \href{http://docs.qore.org/modules/yaml/current/YamlRpcClient/html/index.html}{\texttt{ Yaml\+Rpc\+Client}}\+: provides an API for easily making YAML-\/\+RPC calls over the network~\newline
-\/ \href{http://docs.qore.org/modules/yaml/current/YamlRpcHandler/html/index.html}{\texttt{ Yaml\+Rpc\+Handler}}\+: provides infrastructure for implementing YAML-\/\+RPC server-\/side services using the \href{../../modules/HttpServer/html/index.html}{\texttt{ Http\+Server}} module  \\\cline{1-3}
binary &\href{https://github.com/qorelanguage/module-zmq}{\texttt{ zmq}} &Provides \href{https://zeromq.org/}{\texttt{ Zero\+MQ}} distributed queue and clustering API support  \\\cline{1-3}
\end{longtabu}
\hypertarget{qore_modules_binary_modules}{}\doxysection{Binary Modules}\label{qore_modules_binary_modules}
Binary modules are written in C++ and delivered in binary form. They must conform to the Qore Module API and have the file extension {\ttfamily \char`\"{}$\ast$.\+qmod\char`\"{}}. Binary modules normally depend on other shared libraries and therefore can only be loaded if the libraries they require are present on the system and can be found in the library path.

Binary modules are merged into \mbox{\hyperlink{class_qore_1_1_program}{Program}} objects in the same way as the static system namespace objects are imported. It is possible to import a binary module and be able to use only part of its functionality, for example, if the importing \mbox{\hyperlink{class_qore_1_1_program}{Program}} cannot access the filesystem, and the module has functions that access the filesystem, only the functions that access the filesystem will not be available. In user modules, the functional domain is set on the module level and not on the individual function or method level as with builtin objects, so user modules are either completely imported or not at all.

Please note that as of version 0.\+7.\+0 onwards, the source code for binary modules has been split from the main Qore library source code into separate projects; see \href{http://www.qore.org}{\texttt{ Qore\textquotesingle{}s home page}} for more information.\hypertarget{qore_modules_user_modules}{}\doxysection{User Modules}\label{qore_modules_user_modules}
User modules are written in Qore and delivered in source form. They must have the extension {\ttfamily \char`\"{}$\ast$.\+qm\char`\"{}}.

User modules will have their own dedicated \mbox{\hyperlink{class_qore_1_1_program}{Program}} object; the \mbox{\hyperlink{class_qore_1_1_program}{Program}} object is created automatically when the module is loaded and initialized. The module\textquotesingle{}s \mbox{\hyperlink{class_qore_1_1_program}{Program}} object is created with locked parse options as follows\+:
\begin{DoxyItemize}
\item \mbox{\hyperlink{group__parse__options_ga3a99f2973e97f3986630d8204d7b91fd}{PO\+\_\+\+NO\+\_\+\+TOP\+\_\+\+LEVEL\+\_\+\+STATEMENTS}}\+: modules provide API services and are not designed to be executed at the top-\/level. Put any initialization code in the module\textquotesingle{}s {\ttfamily init} closure
\item \mbox{\hyperlink{group__parse__options_ga196e048def21cb147b21a4871c4e9b29}{PO\+\_\+\+REQUIRE\+\_\+\+PROTOTYPES}}\+: to ensure that module\textquotesingle{}s APIs are transparent, all method and function declarations must include parameter and return types
\item \mbox{\hyperlink{group__parse__options_ga77d54a192aeae13bac95700ab5bbb190}{PO\+\_\+\+REQUIRE\+\_\+\+OUR}}\+: this parse option is meant to ensure that typos in variable names are caught at parse time and to ensure transparency of variable types in the module\textquotesingle{}s source code
\item \mbox{\hyperlink{group__parse__options_ga094a2d1f503a2b1e9abbe11b0d47cc6e}{PO\+\_\+\+IN\+\_\+\+MODULE}}\+: this parse option is set so that module code is recognized by the system when parsing modules
\end{DoxyItemize}

When parsing module code, the default warning mask is set to \mbox{\hyperlink{group__warning__constants_ga7f704aa8f7652702d72d22ce93125566}{WARN\+\_\+\+MODULES}}, and any warnings are treated as errors. Furthermore, any restrictions that the importing \mbox{\hyperlink{class_qore_1_1_program}{Program}} object has will be added to the module\textquotesingle{}s \mbox{\hyperlink{class_qore_1_1_program}{Program}} object.

Any \mbox{\hyperlink{qore_namespaces}{namespaces}}, \mbox{\hyperlink{qore_classes}{classes}}, \mbox{\hyperlink{constants}{constants}}, \mbox{\hyperlink{qore_functions}{functions}}, and \mbox{\hyperlink{variables_global_variables}{global variables}} declared as \mbox{\hyperlink{qore_modules_mod_public}{public}} will be exported into the importing \mbox{\hyperlink{class_qore_1_1_program}{Program}} object; all other declarations will be private to the module\textquotesingle{}s \mbox{\hyperlink{class_qore_1_1_program}{Program}} object.

\begin{DoxyNote}{Note}
The root namespace of a module \mbox{\hyperlink{class_qore_1_1_program}{Program}} is always \mbox{\hyperlink{qore_modules_mod_public}{public}} by default, however declarations in the root namespace must be marked \mbox{\hyperlink{qore_modules_mod_public}{public}} to be exported to importing \mbox{\hyperlink{class_qore_1_1_program}{Program}} objects.
\end{DoxyNote}
If a user module imports other modules with the {\ttfamily requires(reexport)} form of the \mbox{\hyperlink{parse_directives_requires}{\%requires}} parse directive, then any loaded definitions will also be loaded into the importing \mbox{\hyperlink{class_qore_1_1_program}{Program}}.

Note that global variables exported from a module\textquotesingle{}s \mbox{\hyperlink{class_qore_1_1_program}{Program}} object are exported as references; each global variable declared in a module is unique, and they reside in the module\textquotesingle{}s \mbox{\hyperlink{class_qore_1_1_program}{Program}} object.

Furthermore, when using an environment with multiple \mbox{\hyperlink{class_qore_1_1_program}{Program}} objects, if a user module has already been loaded and initialized, then it\textquotesingle{}s functional domain mask is compared against any importing \mbox{\hyperlink{class_qore_1_1_program}{Program}} object\textquotesingle{}s restrictions; if the module uses functionality that is not allowed in the importing \mbox{\hyperlink{class_qore_1_1_program}{Program}} object, then an exception is raised and the module is not imported.

Also note that the \mbox{\hyperlink{class_qore_1_1_program_a3b1e638a11c6cf53e9c2b5dfd325decc}{Qore\+::\+Program\+::constructor()}} applies a mask to the parse option mask option when \mbox{\hyperlink{class_qore_1_1_program}{Program}} objects are created in a user module; in this case the parse options passed to the child \mbox{\hyperlink{class_qore_1_1_program}{Program}} object are masked with the current parse options in the user module, and they are locked so that they cannot be made less restrictive. This is to prevent user modules from circumventing functional restrictions imposed by parse options.\hypertarget{qore_modules_user_module_declarations}{}\doxysubsection{User Module Declarations}\label{qore_modules_user_module_declarations}
User modules are declared with a special syntax in Qore\+:

{\bfseries{User Module Declaration Syntax}}~\newline
 ~~~~{\bfseries{{\ttfamily module}}} {\itshape name} {\ttfamily \{}~\newline
 ~~~~~~~~{\ttfamily {\bfseries{version}} = "{}}{\itshape version string}{\ttfamily "{};}~\newline
 ~~~~~~~~{\ttfamily {\bfseries{desc}} = "{}}{\itshape description string}{\ttfamily "{};}~\newline
 ~~~~~~~~{\ttfamily {\bfseries{author}} = "{}}{\itshape author string}{\ttfamily "{};}~\newline
 ~~~~~~~~{\ttfamily \mbox{[}{\bfseries{url}} = "{}}{\itshape URL string}{\ttfamily "{};\mbox{]}}~\newline
 ~~~~~~~~{\ttfamily \mbox{[}{\bfseries{license}} = "{}}{\itshape license string}{\ttfamily "{};\mbox{]}}~\newline
 ~~~~~~~~{\ttfamily \mbox{[}{\bfseries{init}} = }{\itshape \mbox{\hyperlink{expressions_closure}{initialization closure}}}{\ttfamily ;\mbox{]}}~\newline
 ~~~~~~~~{\ttfamily \mbox{[}{\bfseries{del}} = }{\itshape \mbox{\hyperlink{expressions_closure}{deletion closure}}}{\ttfamily ;\mbox{]}}~\newline
 ~~~~{\ttfamily \}}

Module properties are as follows\+:
\begin{DoxyItemize}
\item {\ttfamily version\+:} (required) must be assigned to a string giving the version of the module
\item {\ttfamily desc\+:} (required) must be assigned to a string giving a text description of the module
\item {\ttfamily author\+:} (required) must be assigned to a string giving the module\textquotesingle{}s author\textquotesingle{}s name
\item {\ttfamily url\+:} (optional) if present, must be a string giving the URL of the module
\item {\ttfamily license\+:} (optional) if present, must be a string giving the license of the module
\item {\ttfamily init\+:} (optional) if present, must be a closure that will be executed when the module is loaded; this can be used to initialize the module, for example
\item {\ttfamily del\+:} (optional) if present, must be a closure that will be executed when the module is unloaded; this can be used to stop running services or free resources managed and still allocated by the module, for example
\end{DoxyItemize}

\begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item any unhandled exceptions in the {\ttfamily init} closure will cause the module to fail to load
\item unhandled exceptions in the {\ttfamily init} and {\ttfamily del} closures are displayed on \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}
\end{DoxyItemize}
\end{DoxyNote}
\hypertarget{qore_modules_mod_public}{}\doxysubsection{The \char`\"{}public\char`\"{} Keyword}\label{qore_modules_mod_public}
Only objects defined with the {\bfseries{{\ttfamily public}}} keyword are made available in \mbox{\hyperlink{class_qore_1_1_program}{Program}} objects importing the user module. All other declarations and definitions are private to the module.

The {\bfseries{{\ttfamily public}}} keyword also affects inheritance in child \mbox{\hyperlink{class_qore_1_1_program}{Program}} objects as well as controlling exported symbols from user modules.

The {\bfseries{{\ttfamily public}}} keyword must be used with the following declarations in the module to export them\+:
\begin{DoxyItemize}
\item \mbox{\hyperlink{qore_namespaces}{namespaces}}\+: namespaces themselves must be declared {\bfseries{{\ttfamily public}}} in order for any of their contents also to be exported (it is an error to try to declare public members of a module-\/private namespace). ex\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{public namespace MyNamespace \{ ... \}}

\end{DoxyCode}

\item \mbox{\hyperlink{qore_classes}{classes}}\+: classes not declared {\bfseries{{\ttfamily public}}} will not be exported; there is no way to export part of a class; either the entire class is exported or it is not. ex\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{public MyNamespace \{}
\DoxyCodeLine{    public MyClass \{ ... \}}
\DoxyCodeLine{\}}

\end{DoxyCode}

\item \mbox{\hyperlink{constants}{constants}}\+: constants must be declared {\bfseries{{\ttfamily public}}} to be exported; ex\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{public namespace MyNamespace \{}
\DoxyCodeLine{    public const MyConst = 100;}
\DoxyCodeLine{\}}

\end{DoxyCode}

\item \mbox{\hyperlink{qore_functions}{functions}}\+: function variants must be declared {\bfseries{{\ttfamily public}}} in order to be exported. ex\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{public MyNamespace \{}
\DoxyCodeLine{    public int sub my\_func() \{ ... \}}
\DoxyCodeLine{\}}

\end{DoxyCode}

\item \mbox{\hyperlink{variables_global_variables}{global variables}}\+: only global variables declared {\bfseries{{\ttfamily public}}} will be exported. ex\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{public namespace MyNamespace \{}
\DoxyCodeLine{    public our int OurInt;}
\DoxyCodeLine{\}}

\end{DoxyCode}

\end{DoxyItemize}

\begin{DoxyNote}{Note}
Global variable declarations in a namespace declaration cannot be initialized at the point they are declared, also, since \mbox{\hyperlink{group__parse__options_ga3a99f2973e97f3986630d8204d7b91fd}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+TOP\+\_\+\+LEVEL\+\_\+\+STATEMENTS}} is set for user module \mbox{\hyperlink{class_qore_1_1_program}{Program}} objects, global variables also cannot be initialized at the top-\/level. Use the {\ttfamily init} closure to initialize the module and any global variables requiring initialization.
\end{DoxyNote}
User modules are only imported into a \mbox{\hyperlink{class_qore_1_1_program}{Program}} if the importing \mbox{\hyperlink{class_qore_1_1_program}{Program}} can use all of the capabilities used in the user module. It is not possible to partially import a user module (in contrast with \mbox{\hyperlink{qore_modules_binary_modules}{binary modules}}, which can be imported even if they expose functionality not allowed in the importing \mbox{\hyperlink{class_qore_1_1_program}{Program}}, however that functionality will not be available in that case). User module \mbox{\hyperlink{class_qore_1_1_program}{Program}} objects have a functional domain attribute set on the \mbox{\hyperlink{class_qore_1_1_program}{Program}} level, so either a user module is imported in its entirety or not at all.\hypertarget{qore_modules_User}{}\doxysubsection{Module Example}\label{qore_modules_User}
Here is an example declaring user module {\ttfamily \char`\"{}foo\char`\"{}} version {\ttfamily \char`\"{}1.\+0\char`\"{}}\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{module foo \{}
\DoxyCodeLine{    version = \textcolor{stringliteral}{"{}1.0"{}};}
\DoxyCodeLine{    desc = \textcolor{stringliteral}{"{}test module"{}};}
\DoxyCodeLine{    author = \textcolor{stringliteral}{"{}Foobar Industries, inc"{}};}
\DoxyCodeLine{    url = \textcolor{stringliteral}{"{}http://example.com"{}};}
\DoxyCodeLine{    license = \textcolor{stringliteral}{"{}MIT"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{    init = sub () \{}
\DoxyCodeLine{        Foo::initialized = \textcolor{keyword}{True};}
\DoxyCodeLine{        Bar::OurBool = \textcolor{keyword}{False};}
\DoxyCodeLine{    \};}
\DoxyCodeLine{}
\DoxyCodeLine{    del = sub () \{}
\DoxyCodeLine{        print(\textcolor{stringliteral}{"{}goodbye, cruel world!\(\backslash\)n"{}});}
\DoxyCodeLine{    \}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{\# do not use "{}\$"{}, assume local scope for variables}}
\DoxyCodeLine{\%new-\/style}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{\# nothing in namespace ::Foo is exported}}
\DoxyCodeLine{namespace Foo \{}
\DoxyCodeLine{    \textcolor{comment}{\# inline global variable declarations cannot be initialized when declared}}
\DoxyCodeLine{    our bool initialized;}
\DoxyCodeLine{}
\DoxyCodeLine{    \textcolor{keyword}{class }SuperClass \{}
\DoxyCodeLine{    \}}
\DoxyCodeLine{    \textcolor{keyword}{class }NotSoGreatClass \{}
\DoxyCodeLine{    \}}
\DoxyCodeLine{    \textcolor{keyword}{class }UnstableClass \{}
\DoxyCodeLine{    \}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{\# public members of namespace ::Bar are exported}}
\DoxyCodeLine{public namespace Bar \{}
\DoxyCodeLine{    \textcolor{comment}{\# Bar::SomeClass is exported}}
\DoxyCodeLine{    public \textcolor{keyword}{class }SomeClass \{}
\DoxyCodeLine{    \}}
\DoxyCodeLine{}
\DoxyCodeLine{    \textcolor{comment}{\# Bar::add(int, int) is exported}}
\DoxyCodeLine{    public int sub add(int x, int y) \{ \textcolor{keywordflow}{return} x + y; \}}
\DoxyCodeLine{}
\DoxyCodeLine{    \textcolor{comment}{\# Bar::OurBool is exported}}
\DoxyCodeLine{    public our bool OurBool;}
\DoxyCodeLine{}
\DoxyCodeLine{    \textcolor{comment}{\# Bar::PrivateClass is not exported}}
\DoxyCodeLine{    \textcolor{keyword}{class }PrivateClass \{}
\DoxyCodeLine{    \}}
\DoxyCodeLine{\}}

\end{DoxyCode}


\begin{DoxySince}{Since}
Qore 0.\+8.\+4 user modules are supported

Qore 0.\+9.\+0 user modules can be separated in multiple files
\end{DoxySince}
\hypertarget{qore_modules_user_module_program_scope}{}\doxysubsection{Program Scope in Object-\/\+Oriented Programs Using User Modules Providing Their Own Threads}\label{qore_modules_user_module_program_scope}
When using the \mbox{\hyperlink{parse_directives_exec-class}{\%exec-\/class}} parse directive, the application object will go out of scope as soon as the constructor terminates (unless there are valid scope-\/extending references to the application object, such as making an assignment of {\ttfamily self} to a global variable in the contructor).

Therefore when using a module that provides services in its own threads (such as, for example, the \href{../../modules/HttpServer/html/index.html}{\texttt{ Http\+Server}} module), it\textquotesingle{}s important to make sure that the application object does not go out of scope while non-\/static method call references to the application object are needed by active threads in the user module (for example, non-\/static method call references passed as callbacks to the \href{../../modules/HttpServer/html/index.html}{\texttt{ Http\+Server}} module, etc).

This also applies to call references to non-\/static methods passed to set\+\_\+signal\+\_\+handler().

If a module thread tries to use a callback or closure in a \mbox{\hyperlink{class_qore_1_1_program}{Program}} that has already gone out of scope, an {\ttfamily OBJECT-\/\+ALREADY-\/\+DELETED} exception ({\ttfamily \char`\"{}attempt to access member of an already-\/deleted object\char`\"{}}) is thrown.

Therefore in such cases it\textquotesingle{}s best to wait for all threads in any modules to terminate before allowing the application object\textquotesingle{}s constructor to terminate.

For an example of this, see the example program {\ttfamily examples/httpserver.\+q} where the main \mbox{\hyperlink{class_qore_1_1_program}{Program}} calls Http\+Server\+::wait\+Stop() before exiting the application object\textquotesingle{}s constructor for this reason. 