GETAPPINSTANCE crash | developer.brewmp.com GETAPPINSTANCE crash | developer.brewmp.com

Developer

GETAPPINSTANCE crash

Forums:

Hi everybody.
am relatively new 2 BREW , now tht v hav started with our application, whenever i call GETAPPINSTANCE in my application ,it works fine.and when i cal GETAPPINSTANCE in our Library , it crashes!!

plz can ny one guide me.
and correct wht mistake am doing.

thanx in advance
Raghu sk

you're going to have to provide more information than that to get a good answer .
library code should be no different to .obj code.

you're going to have to provide more information than that to get a good answer .
library code should be no different to .obj code.

hi, Charles,
here is my code snippet
//this is the global init function which is called while creating
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)
static boolean Browser5_InitApp(BrowserApp * pApp)
{
int RetVal = 0;
RetVal = DDL_Initialiaze( ) ;// i cal a local function here.
return (RetVal) ;

int DDL_Initialiaze()
{
int eRet ;
BRE_JDD *pApp = (BRE_JDD *) GETAPPINSTANCE ( ) ; //this works fine
eRet =jdd_FSInitialize (NULL); // this is a call to library
return JC_OK ;
}
int jdd_FSInitialize (JDD_FSHANDLE * pFileSysHandle)
{
BREW_JDD *pApp = (BREW_JDD * ) GETAPPINSTANCE();//****CRASH****
if((ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR,(void**)(&pApp->pFileMgr)) != SUCCESS) )
{
return FALSE;
}
return JC_OK ;
}
and here is BREW_JDD struct
typedef struct _BREW_JDD
{
AEEApplet a;
int m_nControlCreated;
int m_nWindowCreated;
IFileMgr *pFileMgr;
BREW_JDD;
can nyone explain me where am going wrong, y this crash happens here???

hi, Charles,
here is my code snippet
//this is the global init function which is called while creating
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)
static boolean Browser5_InitApp(BrowserApp * pApp)
{
int RetVal = 0;
RetVal = DDL_Initialiaze( ) ;// i cal a local function here.
return (RetVal) ;

int DDL_Initialiaze()
{
int eRet ;
BRE_JDD *pApp = (BRE_JDD *) GETAPPINSTANCE ( ) ; //this works fine
eRet =jdd_FSInitialize (NULL); // this is a call to library
return JC_OK ;
}
int jdd_FSInitialize (JDD_FSHANDLE * pFileSysHandle)
{
BREW_JDD *pApp = (BREW_JDD * ) GETAPPINSTANCE();//****CRASH****
if((ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR,(void**)(&pApp->pFileMgr)) != SUCCESS) )
{
return FALSE;
}
return JC_OK ;
}
and here is BREW_JDD struct
typedef struct _BREW_JDD
{
AEEApplet a;
int m_nControlCreated;
int m_nWindowCreated;
IFileMgr *pFileMgr;
BREW_JDD;
can nyone explain me where am going wrong, y this crash happens here???

Is it a static linked library or dynamically linked??

Is it a static linked library or dynamically linked??

GETAPPINSTANCE() return NULL when application not init.
Maybe GETAPPINSTANCE() return NULL, and your code quote pApp(It's NULL) then crash.

GETAPPINSTANCE() return NULL when application not init.
Maybe GETAPPINSTANCE() return NULL, and your code quote pApp(It's NULL) then crash.