> >I'm a PalmOS newbie, so I may be doing something wrong, but I
> >just noticed that this code:
> >
> >  AppNetRefnum = -1;
> >  error = SysLibFind("Net.Lib", &AppNetRefnum);
> >
> >does not return an error (ie. it returns 0), and it does not
> >set AppNetRefnum (it remains -1 after the call).  If I change
> >the call to use the correct name of Net.lib like so:
> >
> >  error = SysLibFind("Net.lib", &AppNetRefnum);
> >
> >then it sets AppNetRefnum appropriately.
> 
> 
> Looking at the sources, what you report appears to be impossible.  What OS
> version did you detect this on?
> 
> The code is written such that the routine can't exit with a result of 0
> without first setting the return paramater to a positive value.  Also, the
> test for name matching is not case sensitive, so both of the above calls
> should return the same result.
> 
> That is, on OS 3.5 (and possibly earlier, I didn't check) the return code
> looks like this:
> 
>               // See if it matches
>               if (!StrCompare(nameP, libNameP)) {
>                       *refNumP = refNum;
>                       return 0;
>               }
> 
> At this point, refNum will always be 0 or greater.

 You're right - brain fart on my part. I had a scoping problem
 with the way I was testing the return value.

 Anyway, I just stepped through it again in gdb to be sure and 
 when SysLibFind() fails, it is definitely returning non-zero. 

 Note that, at least on OS 3.3, SysLibFind() DOES appear to be 
 case sensitive. 

  SysLibFind("Net.Lib", &AppNetRefnum) returns sysErrLibNotFound
  SysLibFind("Net.lib", &AppNetRefnum) returns  0

 -w

--
May the forces of evil become confused on the way to your house.


Reply via email to