[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libssh and Visual C++ (again)


Le 26/09/2012 15:33, Christophe Baribaud a écrit :
I suggest the included patch
It creates a new data type "ssh_ssize_t" which equals ssize_t when this type exists, and is the signed integer with the same bit count as size_t when ssize_t is not defined.
I tested it under Linux 64 bits, Windows 32 bits and Windows 64 bits
Christophe

2012/9/25 Werner Koch <wk@xxxxxxxxx <mailto:wk@xxxxxxxxx>>

    On Mon, 24 Sep 2012 10:11, asn@xxxxxxxxxxxxxx
    <mailto:asn@xxxxxxxxxxxxxx> said:

    > Ok, then we should probably use
    >
    > typedef uint64_t ssh_ssize_t;

    IMHO, the best way to handle system dependent definition is to
    provide a
    header file customized for the system.  Thus at build time you
    don't use
    and install the header you distribute with the source but one which
    matches the system's requirement.  For example on GNU systems you may
    simply

     #include <unistd.h>

    but on Windows you install a header with the line:

     typedef int ssize_t;

    (or whatever the particular Windows system requires).  Because
    sometimes
    users simply throw in any header file they found somewhere, I
    often add
    a configure check to see whether the header matches the expected one
    (e.g. using the CPU-OS-VENDOR string)

    Adding your own type merely shifts the responsibility from you to the
    user ;-)



    Salam-Shalom,

       Werner


    --
    Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.



I just realized that the file config.h is private, and is not copied into the installation directory, so my patch is not valid (it works only for libssh itself, not for the program which uses the library) It is possible to modify the sftp.h file from a new "sftp.h.cmake" file, but is it a good practice to have an installed header file whose content varies from an architecture to another?

Christophe

Follow-Ups:
Re: libssh and Visual C++ (again)Werner Koch <wk@xxxxxxxxx>
References:
libssh and Visual C++ (again)Christophe Baribaud <christophe.baribaud@xxxxxxxxx>
Re: libssh and Visual C++ (again)Andreas Schneider <asn@xxxxxxxxxxxxxx>
Re: libssh and Visual C++ (again)Christophe Baribaud <christophe.baribaud@xxxxxxxxx>
Re: libssh and Visual C++ (again)Andreas Schneider <asn@xxxxxxxxxxxxxx>
Re: libssh and Visual C++ (again)Werner Koch <wk@xxxxxxxxx>
Re: libssh and Visual C++ (again)Christophe Baribaud <christophe.baribaud@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org