Daniel Stenberg <daniel_at_haxx.se> writes:
> 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.
+1. It is typical for shared libraries to have one init/done function
for global (de-)initialization.
This won't solve the libgcrypt thread mutex issue completely, though,
because only the application knows what kind of thread library is in
use, and it is the application that needs to configure libgcrypt
properly. But this is the same as for any other application linking
with anything that ultimately links to libgcrypt.
/Simon
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-03-01