Hi,

I hope someone can help me.  I have listed the Tools that I am using,
and code functions opening & closing Mathlib.  I'm new to Palm
Programming and my first goal after the hello world program was to
create some very simple apps that take a few inputs, and calculate a
value.  Things that are simple but useful, and build upon that.

Anyway,  I muddled thru discovering mathlib, and finding out I needed to
update libgcc.a, etc, and finally got my program to open up, take my
inputs and generate the desired output.  Now when I try to exit the
application I get the following error:

With 'MathLibClose(MathLibRef, usecount)' "Application" 1.0 has just
performed an illegal operation.  It performed a "address error".  If
this ....

With 'MathLibClose(MathLibRef, &usecount)'"Application" 1.0 has just
performed an illegal operation.  It performed a "bus error".  If this
...

If I comment out the above call,  the error I get is for "Applications"
3.3,  something about trying to access unallocated memory.  I was
expecting some kind of error, since I had a connection opened up, that I
hadn't closed.

Anyway,  I'm wondering if there is an obvious problem in my code that
someone might see, or if I need to make some additional modifications
with the new 3.5 SDK.

Sorry for all the bandwidth,  I'm just trying to give as much info as to
my situation as I can think of, that might be useful.

Michael Gregoire

Tools:
PalmDev - SDK 3.5
PRC-Tools - 2.0
CYGWIN - b20
MathLib - Version 1.01, 23 August 1997, Rick Huebner

Start Code:

static int StartApplication(void)
{
  int error;

  /*  Code to open a link to Math shared library in Palm */
  error = SysLibFind(MathLibName, &MathLibRef);
  if (error)
    error = SysLibLoad(LibType, MathLibCreator, &MathLibRef);
  ErrFatalDisplayIf(error, "Can't find MathLib"); // Just an example;
handle it gracefully
  error = MathLibOpen(MathLibRef, MathLibVersion);
  ErrFatalDisplayIf(error, "Can't open MathLib"); 

  error = OpenDatabase();
  if (error) 
    return error;

  FrmGotoForm(formID_nav);
  return 0;
}


StopCode:
static void StopApplication(void)
{
  Err error;
  UInt16  usecount = -1;    /*  Have also Tried UInt  */

  FldSetTextHandle(fieldptr_text, NULL);
  FldSetTextHandle(fieldptr_hex, NULL);
  FldSetTextHandle(fieldptr_out, NULL);
  DmCloseDatabase(NavDB);

  error = MathLibClose(MathLibRef, usecount); /** Getting Error Here,
with both 
                                                  usecount and &usecount


**/
  ErrFatalDisplayIf(error, "Can't close MathLib");
  if (usecount == 0)
    SysLibRemove(MathLibRef); 

}


With 'MathLibClose(MathLibRef, usecount)' "Application" 1.0 has just
performed an illegal operation.  It performed a "address error".  If
this ....

With 'MathLibClose(MathLibRef, &usecount)'"Application" 1.0 has just
performed an illegal operation.  It performed a "bus error".  If this
...

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