Subject: Re: example/direct_tcpip.c missing header

Re: example/direct_tcpip.c missing header

From: Peter Stuge <peter_at_stuge.se>
Date: Wed, 2 Jun 2010 06:17:14 +0200

Hey,

Guenter wrote:
> is there any reason why we have a different include head in
> example/direct_tcpip.c than with the other samples?

I wrote that example and I find it ridiculous for our examples to
depend on configuration information for the library.

libssh2_config.h is internal to the library and thus absolutely off
limits for all applications.

The examples should demonstrate the best way to use the library.
The fact that they are built at the same time as the library is
unfortunate for us as project contributors since we need to make them
build in that setting rather in an application build setting, but it
is IMO not at all a reason to make them depend on library-internal
information. They are example applications, and must not be tied to
the library in any way besides the public API.

> is there agreement that we use something like this:
>
> #include "libssh2_config.h"

Certainly not, as far as I'm concerned.

I think that the examples should be very simple programs. Since the
library is cross-platform, the examples kinda need to be as well, but
I think we should make a point of dealing with any cross-platform
issues within the examples using the simplest way possible.

In doing so we show readers how they could easily do it if they want
to, and we avoid messing up the source code more than absolutely
neccessary for readers that do not care for portability and only want
to learn about using the library.

CLI apps are fairly likely candidates for portability, but if I'm
making a win32 GUI app then I will not neccessarily be interested
in making it portable, since win32 is, well, special.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-06-02