I thought that protecting the database with DmDatabaseProtect would only
prevent the database from beeing deleted (and broadcast a
sysNotifyDeleteProtectedEvent notification).  This does not mean that
the code resource will be kept locked if I leave my application and launch another one.

I need the protection because this is not a callback by launching code,
but a callback with the function pointer.  The segment must not move,
and the database must not be deleted.

Regards,
Jerome


Dr. Vesselin Bontchev wrote:
Is that the correct way of doing it?


I think so. What do you need the protection for? Depending on what
you're trying to do, locking the handle to the code resource might
not be necessary - just protecting the database that contains it
should be enough.


BTW, I always have a 24bytes code resource 0. What is it used for?


Various program settings like stack size and stuff. It doesn't really
contain code - just data.


The "real" code seems to be in resource 1 and up (for multi segment?)... is it always the case?


Normally, yes. Depends on your definition of "always", though. :-) At
least this is where the compilers put the code of a 68k application.
But nothing prevents an application from storing code in a custom
resource and executing it at runtime - although it will have to go
through a few hoops to do that.

Also, I have the impression that PNO applications keep their code in
a different kind of resource (ARMC?), although I'm not sure about
this; I've never written a PNO.

Regards, Vesselin


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

Reply via email to