[Libssh] undefined refs linking to server functions FIXED

Aris Adamantiadis aris at 0xbadc0de.be
Sat Apr 12 01:03:36 CEST 2008


Matt Lawson a écrit :
> Ha!  Fixed it!  As usual the solution came to me once
> I stopped pounding the keyboard and walked away for a
> while...
> 
> server.h is missing the sequence:
> 
> #ifdef __cplusplus
> extern "C" {
> #endif
> ...
> #ifdef __cplusplus
> } ;
> #endif
> 
> This sequence is present in other files such as
> libssh.h and sftp.h, that's why those worked with my
> app which is, obviously, written in C++.  So that
> should prolly be added to server.h.
> 
> One other unrelated consistency I ran across: 
> ssh_options_new() is in libssh.h but
> ssh_options_free() is in priv.h which describes itself
> as "[stuff] the user app shouldn't have to [mess
> with]".  So I'm unclear as to if I'm supposed to be
> allocating SSH_OPTIONS dynamically or just use the
> stack.
> 
> Keep up the good work!
> - matt
> 
hello,

the missing #ifdef __cplusplus is a bug, i'll see if it was already 
fixed in the subversion.
the later is a design weakness. In fact you should not free the 
ssh_option object since it "belongs" to the ssh_session object. it's 
going to be changed in libssh 0.3.
So to use it, you just need to allocate one (ssh_options_new()), then 
attach it (ssh_set_options) and then forget about it.


Thanks for your report,
Aris



More information about the Libssh mailing list