Discussion:
missing endian declarations for C
(too old to reply)
Ron
2018-01-12 22:32:48 UTC
Permalink
Error: implicit declaration of be64toh

Does anyone know how I can correctly implement declarations in
particular (but only a subset of what other OS's support)

htole32(x) htole64(x) be32toh(x) be64toh(x) htobe32(x) htobe64(x)

I think the h refers to 'host integer'
to date I have compiled using

#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__

#if defined(__riscos__)

#include <endian.h>
#include <string/byteswap.h>

#define htole32(x) (x)
#define htole64(x) (x)
#define htobe64(x) __bswap_64 (x)
#define be64toh(x) __bswap_64 (x)

#endif
#endif

But compared to Windows LE is likely to be simplifying the situation?

The header file is part of telegram-cli
(tg.tgl.tl-parser.h.portable_endian)
or tg/tgl/tl-parser/portable_endian.h

TIA Ron M.

PS
Posting here until I get my posts from the GCCSDK sorted.
I can post but not receive, and can't even receive a password reminder
so I can investigate my account. So far have checked spam, but will now
have to contact Theo.
Ron
2018-01-13 11:44:42 UTC
Permalink
Post by Ron
Error: implicit declaration of be64toh
Does anyone know how I can correctly implement declarations in
particular (but only a subset of what other OS's support)
htole32(x) htole64(x) be32toh(x) be64toh(x) htobe32(x) htobe64(x)
I think the h refers to 'host integer'
to date I have compiled using
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if defined(__riscos__)
#include <endian.h>
#include <string/byteswap.h>
#define htole32(x) (x)
#define htole64(x) (x)
#define htobe64(x) __bswap_64 (x)
#define be64toh(x) __bswap_64 (x)
#endif
#endif
But compared to Windows LE is likely to be simplifying the situation?
The header file is part of telegram-cli
(tg.tgl.tl-parser.h.portable_endian)
or tg/tgl/tl-parser/portable_endian.h
The Windows CYGWIN method uses the same functions we have in
byteorder.h aimed at network(also BE) conversion, We dont have the
64bit representation, so I opted for copying the xbox method
using __builtin_bswap, except reversed for LE.

#include <endian.h>
#include <string/byteswap.h>

#define htole16(x) (x)
#define htobe16(x) bswap_16(x)
#define le16toh(x) (x)
#define be16toh(x) bswap_16(x)

#define htole32(x) (x)
#define htobe32(x) bswap_32(x)
#define le32toh(x) (x)
#define be32toh(x) bswap_32(x)

#define htole64(x) (x)
#define htobe64(x) bswap_64(x)
#define le64toh(x) (x)
#define be64toh(x) bswap_64(x)

I found a patch from Raspberry Pi installation of telegram-cli
that fixes the problem I thought I was causing.

One can play around with different devices just using the one
phone number apparently, I have sent a message back from
my phone to the Iyonix, using the RPI guide.
Compiling in a similar fashion on debian laptop, I could use
-O2 optimisation but on the Iyonix any optimisation causes errors.
I have removed the flags for shared libraries.
Feels a bit strange, it needs a massive wimpslot, converting to
aif reduces the wimpslot requirements dramaticaly. The only big
library is libcrypto.
I need to make a readme and add an icon and I'll make the lot
available so interested people can try it/ maybe improve the C.
A total build takes about 40 minutes on the Iyonix in GCC 4.7.4
elf = 9,676,643 aif = 6,367,204 bytes

Ron M.

Loading...