"Alexandre Duret-Lutz" <[EMAIL PROTECTED]> wrote in message
news:44170@palm-dev-forum...
> The reason I
> asked this was not that I want to choose a library name with
> a sane length, but because I'm writing a function the lookup
> the library name from a given SysLib database.  The caller
> of that routines needs to allocate enough place for the library
> name, or if there is no limit as it appears to be the case, I
> have to take an aditionnal argument to limit the length of the
> looked-up name.

This is the approach I would take.

>       /* Call the initialization function, with a dummy SysLib table
> entry.  FIXME: Does the RefNum argument really matters?  */
>       SysLibTblEntryType entry;
>       entry.dispatchTblP = 0;
>       ((SysLibEntryProcPtr) codePtr) (1234, &entry); /* Error code
ignored.  */

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

Some shared libraries do some initialization when they set up their dispatch
tables. Arguably, they should wait for the Open() call, but they don't
always do this. Such misbehaving libraries won't take kindly to having their
code resources unlocked under them. As long as the libraries are being
created by you, this shouldn't be a problem. You can make sure your
libraries don't do anything "on the side" when they set up their dispatch
tables. But if you're writing the libraries, you can specify any rule you
want for the library names. You could impose a limit on their lengths, or
you could even specify that the library names are always the same as the
database names, making this whole problem trivial. So I'm guess that you
want your code to work with arbitrary shared libraries. I can't think of a
way to do what you want. Sorry.
--
Danny Epstein
OS Engineer, Palm Inc.



-- 
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