[odb-users] Support for ODB on QNX

Juan Pablo Samper jp.samper at apex.ai
Tue Aug 25 14:01:43 EDT 2020


Hi Boris,

I agree that "hacking things to match" is not really the way to go.
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. I guess I was hoping that there
is a way to tell the ODB compiler to use the QNX definition rather than the
Linux definition.

That being said, I'm working with one of my team members to figure out the
exact mapping
that we need to configure to get this working. I'll report back.

Best,
JP




On Mon, Aug 24, 2020 at 4:17 AM Boris Kolpackov <boris at codesynthesis.com>
wrote:

> Juan Pablo Samper <jp.samper at apex.ai> writes:
>
> > When compiling a file generated by the odb compiler, I get the following
> > errors:
> >
> > analysis_result_odb.cpp:105:11: error: '::__time_t' has not been declared
> > analysis_result_odb.cpp:114:7: error: '::__suseconds_t' has not been
> > declared
>
> When generating database support code on one platform to be used on
> another you have to be careful not to depend on platform-specific
> definitions (or hack things around to match). I am pretty sure the
> above error is caused by your use of struct timeval.
>
> One way to resolve this would be to map timeval to a value type that
> has a platform-independent definition. Something along these lines
> (the mapping might need some type casting to get rid of warnings):
>
> #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})
>


-- 

Juan Pablo Samper

Software Tooling and Infrastucture

Apex.AI

www.apex.ai


More information about the odb-users mailing list