(I wound up snipping all the code. Sorry about that.)
In article <bdcg1q$gm3$>
Claire <> writes:
>My actual function prototype is
>void MessageDlg(U8 nKeyMask, const U8 *pszTitle, const U8 **Items, U8
>numItems);
>Where nKeyMask is a mask of the key strokes accepted to close the dialog
>pszTitle is title of the dialog box
>Items is a pointer to an array/list of strings/char*
>numItems is the number of items in the array.
You are using "U8" instead of "char *" (e.g., for pszTitle), but
compiler-generated strings have type "array of char". This forces
you to use casts.
Casts are bad news. If your code were to compile cleanly (no
errors, no warnings, etc.) when cast-free, it would have a
significantly higher chance of working. Of course, as I think you
already found, simply changing "U8" to "char" does not make the
code compile cleanly.
The reason is that you have confused arrays, which can become
pointer values under particular circumstances, with pointers.
Although array objects do sometimes produce pointer values, array
objects are not themselves pointers.
>Please. Why is it not possible to pass the correct parameter directly rather
>than copying to another variable then passing that one?
See <http://67.40.109.61/torek/c/pa.html>. When you have an array
named A of size N and element-type T, and pass &A to some other
function, you get a pointer value of type "pointer to array N of
T" that points to the entire array. If you pass "the value" of A,
or use &A[0], you get a value of type "pointer to T" that points
to the first element of the array A.
>Our records are large arrays of structs that are assigned permanent noinit
>space in battery backed ram. We have no heap or dynamic allocation.
Such memory is usually a (relatively) scarce resource, so you might
want to encode things tightly in this space, and expand them out for
"regular" use in ordinary (non-backed-up) RAM. This sort of thing
is probably more an issue for comp.arch.embedded, though.
--
In-Real-Life: Chris Torek, Wind River Systems (BSD engineering)
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it
http://67.40.109.61/torek/index.html (for the moment)
Reading email is like searching for food in the garbage, thanks to spammers.