[odb-users] Support for ODB on QNX

Juan Pablo Samper jp.samper at apex.ai
Thu Aug 27 14:18:30 EDT 2020


Hi Boris,

Thanks for your advice. I think we'll avoid opening that can of worms for
now.

I do have a stupid question, though: You suggested that we "map timeval to
a value type that
has a platform-independent definition." Should we be using this mapping
instead of or in addition to #pragma db value(timeval) definition.
In other words, should the code be:

// #pragma db value(timeval) definition
#pragma db value
struct odb_timeval
{
  std::int64_t tv_sec;
  std::int64_t tv_usec;
};

#pragma db map type(timeval) as(odb_timeval)  \
    to(odb_timeval{(?).tv_sec, (?).tv_usec})  \
    from(timeval{(?).tv_sec, (?).tv_usec})

OR

#pragma db value(timeval) definition
#pragma db value
struct odb_timeval
{
  std::int64_t tv_sec;
  std::int64_t tv_usec;
};

#pragma db map type(timeval) as(odb_timeval)  \
    to(odb_timeval{(?).tv_sec, (?).tv_usec})  \
    from(timeval{(?).tv_sec, (?).tv_usec})

Thanks!
JP




On Wed, Aug 26, 2020 at 5:55 AM Boris Kolpackov <boris at codesynthesis.com>
wrote:

> Juan Pablo Samper <jp.samper at apex.ai> writes:
>
> > I also get that we have to be careful to not use platform-specific
> > constructs; however, QNX defines its own timeval, which wraps the
> > platform-specific part (e.g. __time_t).
> > The ODB compiler seems to be using information from the underlying Linux
> > implementation of timeval which negates the QNX wrapper.
>
> Yes, it uses Linux headers since you built the ODB compiler to use
> host's GCC. If your QNX cross-compiler is also GCC and has plugin
> support enabled, then theoretically you could build ODB to use that
> (and thus QNX headers), however, we never tried anything like that.
>
> Note also that depending on platform-specific definitions has other
> drawbacks. For example, POSIX does not define the size of types used
> in the timeval definition and the implementation is free to change
> them from release to release. So you may end up with different and
> incompatible database schemas on, say, qnx6.0.0 and qnx7.0.0.
>
> Overall, depending on platform-specific definitions for database
> mapping is a can of worms that we strongly recommend one does not
> open.
>


-- 

Juan Pablo Samper

Software Tooling and Infrastucture

Apex.AI

www.apex.ai


More information about the odb-users mailing list