"Jacob Vitas Vogelstein" <[EMAIL PROTECTED]> wrote:

> I have a weird problem: The first time I run my hack, it detects no records
> in its database and creates one.  That works fine.  However, if I try to
> configure my hack (click on the '+' icond) before it has run for the first
> time, it crashes.  The InitDatabase procedure that i call is the same for
> both the hack patch code and the form event handler code.  The specific line
> that crashes when called from the form event handler on a FrmLoadForm is in
> function Boolean InitDatabase(DmOpenRef prevAppHackDB):
> 
>  hrecord = DmNewRecord( prevAppHackDB, (UInt*)PREVAPP_RECORD_LOC,
> DB_PREVAPP_RECORD_SIZE );
> 
> The POSE error is " "HackMaster" has just read directly from memory location
> zero (NULL). "
> 
> this call is preceeded by:
> 
>    if( ((error = DmCreateDatabase(0, "PrevAppHackDB", 'JVV-', 'prev',

Here is your problem ------------------^^^^^^^^^^^^^^^
The linker puts this string literal in a segment that does not end up 
being part of the code resource that goes into your hack PRC. If you're 
using CodeWarrior you may be able to fix this by enabling the "PC 
relative strings" option (it's something like that, I don't use CW, but 
I remember somebody mentioning this a while back on this list). If 
you're using prc-tools, simply add a string resource to your .rcp file 
that contains the name of the database, then use something like
    char *dbname;
    SysCopyStringResource(resourceID, dbname);
    DmCreateDatabase(0, dbname, 'JVV-', ...);

--
Roger Chaplin
<[EMAIL PROTECTED]>

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