Subject: Re: Missing functions like libssh2_[init|exit]

Re: Missing functions like libssh2_[init|exit]

From: Daniel Stenberg <>
Date: Mon, 1 Mar 2010 16:40:44 +0100 (CET)

On Mon, 1 Mar 2010, Lars Nordin wrote:

> I think there should exist a libssh2_init(), where all necessary initialized
> are done. Maybe to be backward compatible libssh2_init can be called in
> session_init() if sone configurations-option is used (--with
> implicit_init??)
> I don't know right now what shall be done in libssh2_exit, but an init-call
> should be ended with an exit-call.

I too think we need to have an init function - as the crypto libs need global
inits. It might even so so that the init functions that init OpenSSL or gcrypt
are not even thread safe (iirc) so we need to document that properly - if that
is indeed the case.

The exit/cleanup function would do the reverse of the init function, as
OpenSSL for example allocates data in their init calls that can be cleaned up
afterwards when nothing else is using it anymore.

Received on 2010-03-01