On Thu, Nov 28, 2002 at 06:44:54PM -0500, Dominique wrote:
>> Of course, if I ignore this then after 15 tries I get an error when I launch
>> the app, saying that I have overlocked a record. Using the debugger (gdb) I
>> verified that I get this error BEFORE PilotMain executes, and therefore I
>> haven't attempted to open any databases yet.
>
> This  turned out (as is so often the case)  to be my own error. I was using
> C++ and was locking a font resource in the constructor.  I had forgotten that
> I had this object hanging around!

But not unlocking it in the destructor?  Tsk, tsk! :-)

> However, I am interested to know why, after I tried to load my app more than
> 15 times I got the lock count error. The error ocurred at launch before
> PilotMain. This would imply that the run-time must be getting a lock at the
> start.

If the object in question has static storage duration (e.g. is a global)
then its constructor is run *before* PilotMain starts.  Welcome to C++.

I overlooked this possibility when I claimed that the extra code resources
were "the only resources that are locked down before PilotMain() runs but
not immediately unlocked".  If I really had my wits about me, I would have
picked this when you first mentioned that yours was a C++ app :-).

And on Thu, Nov 28, 2002 at 05:53:04PM -0600, Ben Combee wrote:
> The runtime library has to lock the code resources at program start so they
> won't be moved by the system while the program is running.

It's ooookkaaayy, Ben -- we understand that already! :-)

In this case, it turned out that the *code* resources weren't remaining
locked or getting overlocked at all.  All the talk of runtime libraries
and multiple code sections, while interesting :-), was just a red herring.

    John

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

Reply via email to