Well, I'm only doing it so I can pass the data from a process to a
thread I just launched.
If the two threads are in the same process, you don't need
serialization, since they share common memory. (You will need
to ensure synchronized access, however.)
So it's all sorta in the same name space. It's
just my libraries are in C++ and I was hoping to serialize the data
nativly in c++ so that when I copy it into my obj-c objects, i've be
most of the way done w/ performance benefits.
In fact, you're concerned with communicating between two
languages, rather than between two processes or machines.
That's a different kettle of fish entirely; depending on the
representations used, it can vary from trivial (from C++ to C)
to very complicated (C++ to Cobol, perhaps). Serialization is
one solution, of course, but it is rarely the simplest or the
most efficient. Basically, when going from language A to
language B:
-- If possible, use data with compatible formats. This is what
makes C++ to C work so well; C++ more or less requires a
large category of data types to have a format compatible
with C, so all you have to do is pass a pointer to it to the
C function.
-- Failing that, you'll have to convert the data somehow. The
conversions can be more or less complicated: when going from
C++ to Fortran, for example, most of the basic types (int,
float, etc.) will be compatible, so all you have to worry
about is the fact that all Fortran parameters are by
reference, that Fortran arrays are row major, rather
than column major (but that can possibly be handled just by
declaring them differently) and strings---Fortran's
character type is not generally compatible with either
std::string or char[]. If the target is Cobol, on the other
hand, you may end up having to convert double's to BCD, and
what have you.
-- Finally, of course, if you already have serialization
routings available in both languages, you can use them. Be
aware, however, that what this really means is converting
C++ date to a neutral, third format, and then converting
this format back to the format in the other language. And
that the neutral, third format conforms to a number of
constraints which generally make it less efficient to
convert to and from than other formats.
If the serialization is already present and handy in both
languages, or if it is or will be necessary anyway,
serialization is certainly an option to be considered.
Otherwise, however, it is by far the least efficient, both where
it always counts (your time and effort), and in terms of
performance.