mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-11-28 19:23:11 +01:00
233 lines
19 KiB
HTML
233 lines
19 KiB
HTML
<!-- HTML header for doxygen 1.8.14-->
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||
<meta name="generator" content="Doxygen 1.8.15"/>
|
||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||
<title>TDLib: TDLib</title>
|
||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||
<script type="text/javascript" src="jquery.js"></script>
|
||
<script type="text/javascript" src="dynsections.js"></script>
|
||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||
<script type="text/javascript" src="search/search.js"></script>
|
||
<script type="text/javascript" src="tg_doxygen.js"></script>
|
||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||
<link href="tg_doxygen.css" rel="stylesheet" type="text/css"/>
|
||
<link href="tg_tabs.css" rel="stylesheet" type="text/css"/>
|
||
</head>
|
||
<body>
|
||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||
<div id="titlearea">
|
||
<div class="tg_navbar clearfix">
|
||
<div class="tg_navbar_inner">
|
||
<div class="tg_container clearfix">
|
||
<ul class="tg_nav tg_navbar_nav tg_navbar_right tg_hidden_xs">
|
||
<li class="tg_navbar_twitter"><a href="https://twitter.com/telegram" target="_blank"><i class="tg_icon_twitter"></i><span> Twitter</span></a></li></ul>
|
||
<ul class="tg_nav tg_navbar_nav">
|
||
<li><a href="//telegram.org/">Home</a></li>
|
||
<li class="tg_hidden_xs"><a href="//telegram.org/faq">FAQ</a></li>
|
||
<li class="tg_hidden_xs"><a href="//telegram.org/apps">Apps</a></li>
|
||
<li><a href="/api">API</a></li>
|
||
<li><a href="/mtproto">Protocol</a></li>
|
||
<li><a href="/schema">Schema</a></li>
|
||
<li class="active"><a href="/tdlib">TDLib</a></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- end header part -->
|
||
<!-- Generated by Doxygen 1.8.15 -->
|
||
<script type="text/javascript">
|
||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||
/* @license-end */
|
||
</script>
|
||
<script type="text/javascript" src="menudata.js"></script>
|
||
<script type="text/javascript" src="menu.js"></script>
|
||
<script type="text/javascript">
|
||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||
$(function() {
|
||
initMenu('',true,false,'search.php','Search');
|
||
$(document).ready(function() { init_search(); });
|
||
});
|
||
/* @license-end */</script>
|
||
<div id="main-nav"></div>
|
||
</div><!-- top -->
|
||
<!-- window showing the filter options -->
|
||
<div id="MSearchSelectWindow"
|
||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||
</div>
|
||
|
||
<!-- iframe showing the search results (closed by default) -->
|
||
<div id="MSearchResultsWindow">
|
||
<iframe src="javascript:void(0)" frameborder="0"
|
||
name="MSearchResults" id="MSearchResults">
|
||
</iframe>
|
||
</div>
|
||
|
||
<div class="PageDoc"><div class="header">
|
||
<div class="headertitle">
|
||
<div class="title">TDLib </div> </div>
|
||
</div><!--header-->
|
||
<div class="contents">
|
||
<div class="textblock"><p>TDLib (Telegram Database library) is a cross-platform library for building <a href="https://telegram.org">Telegram</a> clients. It can be easily used from almost any programming language.</p>
|
||
<h2>Table of Contents</h2>
|
||
<ul>
|
||
<li><a href="#features">Features</a></li>
|
||
<li><a href="#usage">Examples and documentation</a></li>
|
||
<li><a href="#dependencies">Dependencies</a></li>
|
||
<li><a href="#building">Building</a></li>
|
||
<li><a href="#installing-dependencies">Installing dependencies</a></li>
|
||
<li><a href="#using-cxx">Using in CMake C++ projects</a></li>
|
||
<li><a href="#using-java">Using in Java projects</a></li>
|
||
<li><a href="#using-dotnet">Using in .NET projects</a></li>
|
||
<li><a href="#using-json">Using with other programming languages</a></li>
|
||
<li><a href="#license">License</a></li>
|
||
</ul>
|
||
<p><a class="anchor" id="features"></a> </p><h2>Features</h2>
|
||
<p><code>TDLib</code> has many advantages. Notably <code>TDLib</code> is:</p>
|
||
<ul>
|
||
<li><b>Cross-platform</b>: <code>TDLib</code> can be used on Android, iOS, Windows, macOS, Linux, FreeBSD, OpenBSD, NetBSD, Windows Phone, WebAssembly, watchOS, tvOS, Tizen, Cygwin. It should also work on other *nix systems with or without minimal effort.</li>
|
||
<li><b>Multilanguage</b>: <code>TDLib</code> can be easily used with any programming language that is able to execute C functions. Additionally it already has native Java (using <code>JNI</code>) bindings and .NET (using <code>C++/CLI</code> and <code>C++/CX</code>) bindings.</li>
|
||
<li><b>Easy to use</b>: <code>TDLib</code> takes care of all network implementation details, encryption and local data storage.</li>
|
||
<li><b>High-performance</b>: in the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>, each <code>TDLib</code> instance handles more than 24000 active bots simultaneously.</li>
|
||
<li><b>Well-documented</b>: all <code>TDLib</code> API methods and public interfaces are fully documented.</li>
|
||
<li><b>Consistent</b>: <code>TDLib</code> guarantees that all updates are delivered in the right order.</li>
|
||
<li><b>Reliable</b>: <code>TDLib</code> remains stable on slow and unreliable Internet connections.</li>
|
||
<li><b>Secure</b>: all local data is encrypted using a user-provided encryption key.</li>
|
||
<li><b>Fully-asynchronous</b>: requests to <code>TDLib</code> don't block each other or anything else, responses are sent when they are available.</li>
|
||
</ul>
|
||
<p><a class="anchor" id="usage"></a> </p><h2>Examples and documentation</h2>
|
||
<p>See our <a href="https://core.telegram.org/tdlib/getting-started">Getting Started</a> tutorial for a description of basic TDLib concepts.</p>
|
||
<p>Take a look at our <a href="https://github.com/tdlib/td/blob/master/example/README.md#tdlib-usage-and-build-examples">examples</a>.</p>
|
||
<p>See a <a href="https://tdlib.github.io/td/build.html">TDLib build instructions generator</a> for detailed instructions on how to build TDLib.</p>
|
||
<p>See description of our <a href="#using-json">JSON</a>, <a href="#using-cxx">C++</a>, <a href="#using-java">Java</a> and <a href="#using-dotnet">.NET</a> interfaces.</p>
|
||
<p>See the <a href="https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl">td_api.tl</a> scheme or the automatically generated <a href="https://core.telegram.org/tdlib/docs/td__api_8h.html">HTML documentation</a> for a list of all available <code>TDLib</code> <a href="https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_function.html">methods</a> and <a href="https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_object.html">classes</a>.</p>
|
||
<p><a class="anchor" id="dependencies"></a> </p><h2>Dependencies</h2>
|
||
<p><code>TDLib</code> depends on:</p>
|
||
<ul>
|
||
<li>C++14 compatible compiler (Clang 3.4+, GCC 4.9+, MSVC 19.0+ (Visual Studio 2015+), Intel C++ Compiler 17+)</li>
|
||
<li>OpenSSL</li>
|
||
<li>zlib</li>
|
||
<li>gperf (build only)</li>
|
||
<li>CMake (3.0.2+, build only)</li>
|
||
<li>PHP (optional, for documentation generation)</li>
|
||
</ul>
|
||
<p><a class="anchor" id="building"></a> </p><h2>Building</h2>
|
||
<p>The simplest way to build <code>TDLib</code> is to use our <a href="https://tdlib.github.io/td/build.html">TDLib build instructions generator</a>. You need only to choose your programming language and target operating system to receive complete build instructions.</p>
|
||
<p>In general, you need to install all <code>TDLib</code> <a href="#dependencies">dependencies</a> as described in <a href="#installing-dependencies">Installing dependencies</a>. Then enter directory containing <code>TDLib</code> sources and compile them using CMake:</p>
|
||
<div class="fragment"><div class="line">mkdir build</div><div class="line">cd build</div><div class="line">cmake -DCMAKE_BUILD_TYPE=Release ..</div><div class="line">cmake --build .</div></div><!-- fragment --><p>To build <code>TDLib</code> on low memory devices you can run <a href="https://github.com/tdlib/td/blob/master/SplitSource.php">SplitSource.php</a> script before compiling main <code>TDLib</code> source code and compile only needed targets: </p><div class="fragment"><div class="line">mkdir build</div><div class="line">cd build</div><div class="line">cmake -DCMAKE_BUILD_TYPE=Release ..</div><div class="line">cmake --build . --target prepare_cross_compiling</div><div class="line">cd ..</div><div class="line">php SplitSource.php</div><div class="line">cd build</div><div class="line">cmake --build . --target tdjson</div><div class="line">cmake --build . --target tdjson_static</div><div class="line">cd ..</div><div class="line">php SplitSource.php --undo</div></div><!-- fragment --><p> In our tests clang 6.0 with libc++ required less than 500 MB of RAM per file and GCC 4.9/6.3 used less than 1 GB of RAM per file.</p>
|
||
<p><a class="anchor" id="installing-dependencies"></a> </p><h3>Installing dependencies</h3>
|
||
<p><a class="anchor" id="macos"></a> </p><h4>macOS</h4>
|
||
<ul>
|
||
<li>Install the latest Xcode command line tools, for example, via <code>xcode-select --install</code>.</li>
|
||
<li>Install other <a href="#dependencies">dependencies</a>, for example, using <a href="https://brew.sh">Homebrew</a>: <div class="fragment"><div class="line">brew install gperf cmake openssl</div></div><!-- fragment --></li>
|
||
<li>Build <code>TDLib</code> with CMake as explained in <a href="#building">building</a>. You will likely need to manually specify path to the installed OpenSSL to CMake, e.g., <div class="fragment"><div class="line">cmake -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ ..</div></div><!-- fragment --></li>
|
||
</ul>
|
||
<p><a class="anchor" id="windows"></a> </p><h4>Windows</h4>
|
||
<ul>
|
||
<li>Download and install Microsoft Visual Studio 2015 or later.</li>
|
||
<li>Download and install <a href="https://sourceforge.net/projects/gnuwin32/files/gperf/3.0.1/">gperf</a>. Add the path to gperf.exe to the PATH environment variable.</li>
|
||
<li>Install <a href="https://github.com/Microsoft/vcpkg#quick-start">vcpkg</a>.</li>
|
||
<li>Run the following commands to install <code>TDLib</code> dependencies using vcpkg: <div class="fragment"><div class="line">cd <path to vcpkg></div><div class="line">.\vcpkg.exe install openssl:x64-windows openssl:x86-windows zlib:x64-windows zlib:x86-windows</div></div><!-- fragment --></li>
|
||
<li>Download and install <a href="https://cmake.org/download/">CMake</a>; choose "Add CMake to the system PATH" option while installing.</li>
|
||
<li>Build <code>TDLib</code> with CMake as explained in <a href="#building">building</a>, but instead of <code>cmake -DCMAKE_BUILD_TYPE=Release ..</code> use <div class="fragment"><div class="line">cmake -DCMAKE_TOOLCHAIN_FILE=<path to vcpkg>/scripts/buildsystems/vcpkg.cmake ..</div></div><!-- fragment --></li>
|
||
</ul>
|
||
<p>To build 32-bit/64-bit <code>TDLib</code> using MSVC, you will need to additionally specify parameter <code>-A Win32</code>/<code>-A x64</code> to CMake. To build <code>TDLib</code> in Release mode using MSVC, you will need to additionally specify parameter <code>--config Release</code> to the <code>cmake --build .</code> command.</p>
|
||
<p><a class="anchor" id="linux"></a> </p><h4>Linux</h4>
|
||
<ul>
|
||
<li>Install all <a href="#dependencies">dependencies</a> using your package manager.</li>
|
||
</ul>
|
||
<p><a class="anchor" id="using-cxx"></a> </p><h2>Using in CMake C++ projects</h2>
|
||
<p>For C++ projects that use CMake, the best approach is to build <code>TDLib</code> as part of your project or to install it system-wide.</p>
|
||
<p>There are several libraries that you could use in your CMake project:</p>
|
||
<ul>
|
||
<li>Td::TdJson, Td::TdJsonStatic — dynamic and static version of a JSON interface. This has a simple C interface, so it can be easily used with any programming language that is able to execute C functions. See <a href="https://core.telegram.org/tdlib/docs/td__json__client_8h.html">td_json_client</a> and <a href="https://core.telegram.org/tdlib/docs/td__log_8h.html">td_log</a> documentation for more information.</li>
|
||
<li>Td::TdStatic — static library with C++ interface for general usage. See <a href="https://core.telegram.org/tdlib/docs/classtd_1_1_client.html">Client</a> and <a href="https://core.telegram.org/tdlib/docs/classtd_1_1_log.html">Log</a> documentation for more information.</li>
|
||
<li>Td::TdCoreStatic — static library with low-level C++ interface intended mostly for internal usage. See <a href="https://core.telegram.org/tdlib/docs/classtd_1_1_client_actor.html">ClientActor</a> and <a href="https://core.telegram.org/tdlib/docs/classtd_1_1_log.html">Log</a> documentation for more information.</li>
|
||
</ul>
|
||
<p>For example, part of your CMakeLists.txt may look like this: </p><div class="fragment"><div class="line">add_subdirectory(td)</div><div class="line">target_link_libraries(YourTarget PRIVATE Td::TdStatic)</div></div><!-- fragment --><p>Or you could install <code>TDLib</code> and then reference it in your CMakeLists.txt like this: </p><div class="fragment"><div class="line">find_package(Td 1.7.0 REQUIRED)</div><div class="line">target_link_libraries(YourTarget PRIVATE Td::TdStatic)</div></div><!-- fragment --><p> See <a href="https://github.com/tdlib/td/tree/master/example/cpp/CMakeLists.txt">example/cpp/CMakeLists.txt</a>.</p>
|
||
<p><a class="anchor" id="using-java"></a> </p><h2>Using in Java projects</h2>
|
||
<p><code>TDLib</code> provides native Java interface through JNI. To enable it, specify option <code>-DTD_ENABLE_JNI=ON</code> to CMake.</p>
|
||
<p>See <a href="https://github.com/tdlib/td/tree/master/example/java">example/java</a> for example of using <code>TDLib</code> from Java and detailed build and usage instructions.</p>
|
||
<p><a class="anchor" id="using-dotnet"></a> </p><h2>Using in .NET projects</h2>
|
||
<p><code>TDLib</code> provides native .NET interface through <code>C++/CLI</code> and <code>C++/CX</code>. To enable it, specify option <code>-DTD_ENABLE_DOTNET=ON</code> to CMake. .NET Core supports <code>C++/CLI</code> only since version 3.1 and only on Windows, so if older .NET Core is used or portability is needed, then <code>TDLib</code> JSON interface should be used through P/Invoke instead.</p>
|
||
<p>See <a href="https://github.com/tdlib/td/tree/master/example/csharp">example/csharp</a> for example of using <code>TDLib</code> from C# and detailed build and usage instructions. See <a href="https://github.com/tdlib/td/tree/master/example/uwp">example/uwp</a> for example of using <code>TDLib</code> from C# UWP application and detailed build and usage instructions for Visual Studio Extension "TDLib for Universal Windows Platform".</p>
|
||
<p>When <code>TDLib</code> is built with <code>TD_ENABLE_DOTNET</code> option enabled, <code>C++</code> documentation is removed from some files. You need to checkout these files to return <code>C++</code> documentation back: </p><div class="fragment"><div class="line">git checkout td/telegram/Client.h td/telegram/Log.h td/tl/TlObject.h</div></div><!-- fragment --><p><a class="anchor" id="using-json"></a> </p><h2>Using from other programming languages</h2>
|
||
<p><code>TDLib</code> provides efficient native C++, Java, and .NET interfaces. But for most use cases we suggest to use the JSON interface, which can be easily used with any programming language that is able to execute C functions. See <a href="https://core.telegram.org/tdlib/docs/td__json__client_8h.html">td_json_client</a> and <a href="https://core.telegram.org/tdlib/docs/td__log_8h.html">td_log</a> documentation for detailed JSON interface description, the <a href="https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl">td_api.tl</a> scheme or the automatically generated <a href="https://core.telegram.org/tdlib/docs/td__api_8h.html">HTML documentation</a> for a list of all available <code>TDLib</code> <a href="https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_function.html">methods</a> and <a href="https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_object.html">classes</a>.</p>
|
||
<p><code>TDLib</code> JSON interface adheres to semantic versioning and versions with the same major version number are binary and backward compatible, but the underlying <code>TDLib</code> API can be different for different minor and even patch versions. If you need to support different <code>TDLib</code> versions, then you can use a value of the <code>version</code> option to find exact <code>TDLib</code> version to use appropriate API methods.</p>
|
||
<p>See <a href="https://github.com/tdlib/td/tree/master/example/python/tdjson_example.py">example/python/tdjson_example.py</a> for an example of such usage.</p>
|
||
<p><a class="anchor" id="license"></a> </p><h2>License</h2>
|
||
<p><code>TDLib</code> is licensed under the terms of the Boost Software License. See <a href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a> for more information. </p>
|
||
</div></div><!-- PageDoc -->
|
||
</div><!-- contents -->
|
||
<!-- HTML footer for doxygen 1.8.14-->
|
||
<!-- start footer part -->
|
||
<hr class="footer"/>
|
||
<div class="tg_footer_wrap">
|
||
<div class="tg_footer_columns_wrap clearfix tg_footer_desktop">
|
||
<div class="tg_footer_column tg_footer_column_telegram">
|
||
<h5>Telegram</h5>
|
||
<div class="tg_footer_telegram_description"></div>
|
||
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
|
||
</div>
|
||
<div class="tg_footer_column">
|
||
<h5><a href="//telegram.org/faq">About</a></h5>
|
||
<ul>
|
||
<li><a href="//telegram.org/faq">FAQ</a></li>
|
||
<li><a href="//telegram.org/blog">Blog</a></li>
|
||
<li><a href="//telegram.org/press">Press</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="tg_footer_column">
|
||
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
|
||
<ul>
|
||
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
|
||
<li><a href="//telegram.org/dl/android">Android</a></li>
|
||
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="tg_footer_column">
|
||
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
|
||
<ul>
|
||
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
|
||
<li><a href="//macos.telegram.org/">macOS</a></li>
|
||
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="tg_footer_column tg_footer_column_platform">
|
||
<h5><a href="/">Platform</a></h5>
|
||
<ul>
|
||
<li><a href="/api">API</a></li>
|
||
<li><a href="//translations.telegram.org/">Translations</a></li>
|
||
<li><a href="//instantview.telegram.org/">Instant View</a></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div class="tg_footer_columns_wrap clearfix tg_footer_mobile">
|
||
<div class="tg_footer_column">
|
||
<h5><a href="//telegram.org/faq">About</a></h5>
|
||
</div>
|
||
<div class="tg_footer_column">
|
||
<h5><a href="//telegram.org/blog">Blog</a></h5>
|
||
</div>
|
||
<div class="tg_footer_column">
|
||
<h5><a href="//telegram.org/apps">Apps</a></h5>
|
||
</div>
|
||
<div class="tg_footer_column">
|
||
<h5><a href="/">Platform</a></h5>
|
||
</div>
|
||
<div class="tg_footer_column">
|
||
<h5><a href="//twitter.com/telegram" target="_blank">Twitter</a></h5>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script type="text/javascript">tgApplyFixes();</script>
|
||
</body>
|
||
</html>
|