On Wed, Aug 13, 2003 at 05:24:44PM -0700, Steve K wrote:
> In that case, I'm curious what is wrong with this code that runs fine on the
> palm handheld but is rejected by the emulator with the following error on
> line marked with *:
> 
> Project (1.0) called SysFatalAlert with the message: "Field.c, Line: 7221,
> NULL parameter".
> 
> Is there something wrong with setting fldAttr to NULL before calling
> FldGetAttributes?
> 
> void foo()
> {
>     // Verify field attributes
>     FieldAttrType* fldAttr = NULL;
>     FldGetAttributes(fldP, fldAttr);

I'm actually amazed that it runs fine on the palm handheld. I guess the
handhelds are more forgiving about writing data to memory location
0. That code is bad bad bad.

Try

 FieldAttrType fldAttr;
 FldGetAttributes(fldP, &fldAttr);

Or, if you insist on passing a real pointer to FldGetAttributes:

 FieldAttrType* fldAttr;
 fldAttr = MemPtrNew(sizeof(FieldAttrType));
 FldGetAttributes(fldP, fldAttr);
  ...
 MemPtrFree(fldAttr);

Hint: don't do it this way, but it might give you some insight on what
was wrong with your code.

Also, find a good book on C that explains pass by reference via pointers
vs. pass by value.

-- 
Dave Carrigan
Seattle, WA, USA
[EMAIL PROTECTED] | http://www.rudedog.org/ | ICQ:161669680
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL

Dave is currently listening to Questions - Price You Pay (Instrumental) (Price You Pay)

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to