So, what I am hearing is that I need to define a structure for my data, but
what is a class – is it not identical to a structure, except that a class
is private by default and a structure is public? I can understand that
there are some hidden definitions to both of these, and that there may be
alignment problems, but the fact is that it works fine in several different
operating systems, and different platforms (different endian-ness as well).
It would seem to me that this problem is one of two things – either a
compiler issue, or an issue with QNX internals not adhering to some standard
that these other operating systems have managed to agree upon somehow. I
was hoping that there was some secret compiler setting that would make all
of this a bit more managable, but we have since had to re-write most of
What we had was a nice high-level oo way of dealing with things – a message
base class, custom messages would inherit from this, and you just send them
out – lower-level functions handled the rest. The receive side would
receive the base class, if the message id was a match, then cast it into the
appropriate message class, and utilize the contents at will.
I can understand how class information is not applicable outside of certain
scopes, but doesn’t a struct have the same information somewhere? And most
importantly, any ideas why this works everywhere else? Being that it works
on three other platforms, I am guessing it is more than luck.
Mario Charest firstname.lastname@example.org wrote in message
“Kevin White” <> email@example.com> > wrote in message
news:bg8tsh$7mk$> firstname.lastname@example.org> …
I am trying to get some information regarding how classes get defined
handled in QNX, in comparison to other OSes. We currently have a
this area, and it is only appearing in one of several OSes that we are
developing in – QNX.
At any rate, we are utilizing socket communications, and we are sending
information by transmitting a class across the wire. This works rather
in Windows, VxWorks, and Linux, but on QNX it seems to work much
differently. When we print out all of the data from the class that we
sending, on the other operating systems, there is 4 bytes of information
the front of the socket message that seems to be related to the class
information – if we remove or re-arrange variables or methods within
class, these numbers change. For the QNX system, these numbers seem to
close to the end of the socket message, or between class and subclass
boundaries, perhaps. Whatever the case, we can communicate using
within the context of the PC, but when we actually try to talk to
box (PC, Linux or whatever), the comms fails because the data is not
the same as the other three OSes, and the class information that is
sent from another operating system is mis-interpreted as data.
Has anyone seen anything like this before, or know how to correct for
I beleive you are asking for trouble. There is no requirement in C++ for
classes to have a specific format. Furthermore this has nothing to do
the OS but rather with the compiler. If you build a design based on this
your design is broken. You need to serialized the data or have a
define in your class and send the structure instead. Class may contains
offset/pointer which become meaningless when sent across the network or
across processes in a virtual memory system.