At 02:03 PM 5/22/99 -0700, Jeff Ishaq wrote:
>Greg, when I looked over the source for SysLibLoad, I didn't see any
>mechanism to return failure the second time, which is why I was curious in
>the first place. I actually got off my ass and did some empirical testing
>(which I probably should have done before wasting bandwidth, but you know
>how that goes!) and I discovered some interesting results I'd like to share.
>
>If I SysLibLoad() my shared library twice, I get two sequential valid
>reference numbers. In addition, both copies of the library have their Sleep
>and Wake entry points called upon sleeping and waking. This implies that
>each instance of the library has its own uniqute SysLibTblEntryPtr (this is
>implicit in the fact that they each have their own reference number,
>really).
>
>This is certainly not the behavior either of us expected. If I think about
>it, though, why not? I mean, it's not like two instances of the same shared
>library will have conflicts over their globals, since they don't HAVE
>globals (instead, they each have their own ptr-to-globals-struct). You
>wouldn't even need to use the context pointer mechanism (magic cookies) to
>deal with globals between two instances of the same shared library this way,
>since each instance has its own unique reference number and thus its own
>unique libGlobalsP.
>
>I'm not sure if this is the intended behavior of SysLibLoad(), though. It
>seems a little hairy.
>
>Oh, and one case where you could want to have two instances of a shared
>library open is through a sublaunched app. For example, MyApp opens up
>MySharedLib. Then the user does a 'find', and in MyApp's Find launch code
>handler, I might need a new instance of MySharedLib running to get some
>services from it. Though I suppose if your app opened a shared library
>already, your app's Find launch code handler should probably be smart enough
>to know that. Hm.
>
Jeff,
Great detective work! These are really interesting results. I guess I
didn't check this our thoroughly enough. I agree with your (other) post
that this is probably an OS bug. Perhaps Palm will confirm?
Also, good point about sublaunched apps. I hadn't thought of that.
Thanks for the update!
Greg
Greg Winton
Bachmann Software and Services, LLC
mailto:[EMAIL PROTECTED]
http://www.bachmannsoftware.com
Software Development for Handheld & Mobile Computing, Windows and the Internet
Home of Bachmann Print Manager, the only graphical printing solution for
the Palm Computing Platform