In general the library requires no initialization. There are however some initialization hooks provided which are often useful. These should be called as early as possible and in a multi-threaded application before a second thread is created.
If your application uses its own memory allocation functions or wrappers it is good idea to tell libassuan about it so it can make use of the same functions or wrappers. You do this with
You need to provide all three functions. Those functions need to behave exactly as their standard counterparts (
malloc
,realloc
andfree
). If you write your own functions please take care to seterrno
whenever an error has occurred.
To integrate assuan logging and diagnostics into your own logging system, you may use the following two functions:
This sets the stream to which libassuan should log messages not associated with a specific context to fp. The default is to log to
stderr
. This default value is also changed by usingassuan_set_log_stream
(to set a logging stream for a specific context) unless this function has been used. Obviously this is not thread-safe and thus it is highly recommended to use this function to setup a proper default.
Set the prefix to be used at the start of a line emitted by assuan on the log stream to text. The default is the empty string.
If you intend to use libassuan along with the package libgpg-error it is recommended to switch libassuan into a mode which directly makes use of error codes provided by libgpg-error. Because the Assuan error codes and those of gpg-error overlap, it is required to explicitly request this. You do this by calling the function