In upgrading my project from CW 9.5 to 10.0, I've run into a set of
seemingly bogus errors compiling a file containing inline assembly. The
errors look like:
Error : 'lbz' is not a struct/union/class member
PalmUserManager.cpp line 116 lbz r4, iIsProfileUser
Error : 'lwz' is not a struct/union/class member
PalmUserManager.cpp line 317 lwz r4, oUserID
Error : 'lwz' is not a struct/union/class member
PalmUserManager.cpp line 347 lwz r5, iKeyName
Error : 'lwz' is not a struct/union/class member
PalmUserManager.cpp line 349 lwz r7, oValue
Error : 'lwz' is not a struct/union/class member
PalmUserManager.cpp line 379 lwz r5, iKeyName
Error : 'mr' is not a struct/union/class member
PalmUserManager.cpp line 381 mr r12, tv
The frustrating thing about these errors is that they seem to be on
random lines of assembly code. Some functions compile fine, and others
get errors, with no apparent pattern. For instance, in the following
code, the first function compiles fine and the second gets an error:
OSStatus GetUserNameByID(PalmUserID iUserID, CFStringRef * oUserName)
{
#if __MACH__
static void * tvector = GetFunction("\pUmGetUserNameByID");
register void * tv = tvector;
if (tv != 0) {
register OSStatus result;
asm {
.volatile
lwz r3, iUserID
lwz r4, oUserName
mr r12, tv
lwz RTOC, 4(tv)
lwz r0, 0(tv)
mtctr r0
bctrl
mr result, r3
}
return result;
}
else return gLastLibraryError;
#else
if (::UmGetUserNameByID == 0) return cfragNoLibraryErr;
else return ::UmGetUserNameByID(iUserID, oUserName);
#endif
}
OSStatus GetIDFromName(CFStringRef iUserName, PalmUserID * oUserID)
{
#if __MACH__
static void * tvector = GetFunction("\pUmGetIDFromName");
register void * tv = tvector;
if (tv != 0) {
register OSStatus result;
asm {
.volatile
lwz r3, iUserName
lwz r4, oUserID
mr r12, tv
lwz RTOC, 4(tv)
lwz r0, 0(tv)
mtctr r0
bctrl
mr result, r3
}
return result;
}
else return gLastLibraryError;
#else
if (::UmGetIDFromName == 0) return cfragNoLibraryErr;
else return ::UmGetIDFromName(iUserName, oUserID);
#endif
}
I've checked the source files for invisible characters that might be
causing the problem, and can't find any. Any clues as to what's going
wrong here, and how to work around it?
Thanks,
--Stuart A. Malone
Llamagraphics, Inc.


|