blob: 2f998687daef6342830ed4f5e54447d3949418bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
Getting Started
========================================
All declarations in the library are contained within the namespace
``Botan``, so you need to either prefix types with ``Botan::`` or add
a ``using`` declaration in your code. All examples will assume a
``using`` declaration.
All library headers are included like so::
#include <botan/auto_rng.h>
Pitfalls
----------------------------------------
Use a ``try``/``catch`` block inside your ``main`` function, and catch
any ``std::exception`` throws (remember to catch by reference, as
``std::exception::what`` is polymorphic)::
int main()
{
try
{
LibraryInitializer init;
// ...
}
catch(std::exception& e)
{
std::cerr << e.what() << "\n";
}
}
This is not strictly required, but if you don't, and Botan throws an
exception, the runtime will call ``std::terminate``, which usually
calls ``abort`` or something like it, leaving you (or worse, a user of
your application) wondering what went wrong.
|