>>> "Danny" == Danny Epstein <[EMAIL PROTECTED]> writes:

[...]

 >> ((SysLibEntryProcPtr) codePtr) (1234, &entry);

 Danny> The reference number is just an index into the system's
 Danny> table of loaded libraries. The only special value that
 Danny> I'm aware of is sysInvalidRefNum which is 0xFFFF. Zero
 Danny> should work fine here.

Ok, thanks, I'll use 0 then.

 Danny> Some shared libraries do some initialization when they
 Danny> set up their dispatch tables. Arguably, they should wait
 Danny> for the Open() call, but they don't always do this. Such
 Danny> misbehaving libraries won't take kindly to having their
 Danny> code resources unlocked under them. 

Outch! :(  I'm afraid I'm running my code on all SysLibs
present in the Palm.

 Danny> As long as the libraries are being created by you, this
 Danny> shouldn't be a problem. You can make sure your libraries
 Danny> don't do anything "on the side" when they set up their
 Danny> dispatch tables. But if you're writing the libraries,
 Danny> you can specify any rule you want for the library
 Danny> names. You could impose a limit on their lengths, or you
 Danny> could even specify that the library names are always the
 Danny> same as the database names, making this whole problem
 Danny> trivial. So I'm guess that you want your code to work
 Danny> with arbitrary shared libraries. 

Hmm, yes and no.  In fact I (will) have a set of SysLibs
acting like device drivers and at some point I want to popup 
a list of them and let the user choose the driver s/he wants.
All I need is a way to discriminate my SysLibs from the other
SysLibs present on the system: I can't use the TypeID for
that since it's always `sysFileTLibrary', I don't want to use
the CreatorID because I would have to reserve a range of values,
so I just came with the idea that I could stick a magic string
at the beginning of each SysLib name.  Hence I iterate over
all the SysLib presents, ask for their name with the function 
I sent, and lookup for the magic-string to determinate whether 
it's mine or not.

>From your above comments I'm starting to understand that's this
is unsafe and ugly.  Maybe I should just add a new resource
to each library database and simply check for that resource.  
Bummer, that seems easy, why didn't I think about this before?

[...]

Thanks!
-- 
Alexandre Duret-Lutz


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

Reply via email to