Hi,

I´m using MathLib in my application and never had problems with it. But, when I 
received a new Palm ( Zire 21 ), the problems started to me :-(

First, the problem with raw Ir, so, solved :-)

Now, the problem is with the MathLib, I think. When the user enter in the software, 
and go out ( withou any operation with the software ) the software crashes, in Zire 
21, the software frozen, in Tungsten T2 the palm resets :-(

So, how I get this idea ? When I take off the code where I load and unload the 
MathLib, the software doesn´t crash.

My software is segmented, with 120 kb , the AppStart and AppStop routines, and 
MathLib.c are in the first segment.

Can anyone help me ?

Below, my AppStart and AppStop routines:

/*!
 *
 * \fn static Err AppStart(void)
 *
 * \brief       Get the current application's preferences.
 *
 *
 * \return      Err value 0 if nothing went wrong
 *
 * \note
 * REVISION HISTORY:
 *
 *
 ***********************************************************************/
static Err AppStart(void)
{
        Err err;
    Word prefsSize;
        
        err = SysLibFind(MathLibName, &MathLibRef);
        if(err)
                err = SysLibLoad(LibType, MathLibCreator, &MathLibRef);
        ErrFatalDisplayIf(err, szErrMsg[19]);
        err = MathLibOpen(MathLibRef, MathLibVersion);
        ErrFatalDisplayIf(err, szErrMsg[20]); 

        // Read the saved preferences / saved-state information.
        prefsSize = sizeof(LogPalmPreference);
        if (PrefGetAppPreferences(appFileCreator, appPrefID, &prefs, &prefsSize, true) 
== noPreferenceFound) {
                CreateDefaultPrefs();
        }

        //Inicalizaçao das bases de dados
        err = dbOpenDataBaseByName(INDEX_DB_NAME, dmHdrAttrBackup, &dbLogIndex, true);

        if(err) {
                ShowMsg(MsgEngAlert,szErrMsg[13]);
                return err;
        }

        gNextPoll = TimGetTicks() + POLL_INTERVAL;

        return 0;
}


/*!
 *
 * \fn static void AppStop(void)
 *
 * \brief Save the current state of the application.
 *
 *
 * \return    nothing
 *
 * \note
 * REVISION HISTORY:
 *
 *
 ***********************************************************************/
static void AppStop(void)
{

        Err     error;
        UInt16  openCount;
        
   
        DmCloseDatabase(dbLogIndex);
        
        if(DmFindDatabase(0, LOG_VIEW_DB_NAME)) {
                if(DmOpenDatabaseInfo(dbDownloadView, NULL, &openCount, NULL, NULL, 
NULL) == errNone) {
                        if(openCount > 0 ) {
                                DmCloseDatabase(dbDownloadView);
                        }
                        dbKillByName(LOG_VIEW_DB_NAME);
                }
        }
        else {
                DmGetLastErr();
        }
        
        // Write the saved preferences / saved-state information.  This data 
        // will be backed up during a HotSync.
        PrefSetAppPreferences (appFileCreator, appPrefID, appPrefVersionNum, 
                &prefs, sizeof (prefs), true);

//      ShowMsg(MsgEngAlert, "Vai Fechar a MathLibRef");
        error = MathLibClose(MathLibRef, &openCount);
//      ShowMsg(MsgEngAlert, "Fechou a MathLibRef");
        ErrFatalDisplayIf(error, szErrMsg[21]);
        if (openCount == 0) {
        //      ShowMsg(MsgEngAlert, "Vai remover a MathLibRef");
        SysLibRemove(MathLibRef);
  //    ShowMsg(MsgEngAlert, "Removeu a MathLibRef");
    }

}


Regards,
--- 
Alexandre Estanislau Puhl 
[EMAIL PROTECTED] 
-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to