Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

After seeing a thread with example for background,
I thought it would be nice to give a sample code here for how to create an simple extension. I know there were html file, sample piece of code, many threads and posts. But none of them helped to create an easy extension out of it because of what so ever reason.

Lots of places the function,structure names gave misunderstanding.

Here with I am attaching a demoextension & demoextensionuse. This is based on the code available from the qualcomm website only. I have modified little bit. Please post your question just about this app here.

Download attached files

Demoextension Project
1.Create a project with name demoextension. (I guess developer should be knowing how to create with a given name)

2.Rename demoextension.bid.txt, demoextension.c.txt, demoextension.h.txt into with .txt, the name is given so that I can upload.

3.Create the MIF file, dont add any classid for the applet, directly go to "extension" tab-under exported classes and add the "demoextension.bid file".

4.Then compile and make the dll ready

Demoextensionuse project
1.Create project with name "Demoextensionuse".
2.Rename demoextensionuse.bid.txt and demoextensionuse.c.txt.
3.Carefully read this line - Copy demoextension.bid & demoextension.h file in to this project folder. This is for compilation purpose.
4.Now create the MIF in regular way. But also go to "Dependencies" and add "demoextension"(NOT demoextensionuse, read carefully).
5.Now compile this project and run.

You should be able to see the Date & Time.

This is how you can create any extension as well you can add N number of functions to this.

But there is little bit difference with adding functions to the existing classes(interfaces). For example IFont - function additions. We need to inherit our new extension from the original extension then start adding our function. That need another thread.

Best of Luck.

I am happy to encourage other developers if they can share a sample helloworld application which utilise all the APIs in a Interface. Particularly if the example code is not provided by BREW SDK, then this code will help everybody.

I am happy to encourage other developers if they can share a sample helloworld application which utilise all the APIs in a Interface. Particularly if the example code is not provided by BREW SDK, then this code will help everybody.

Hi bru,
I got 2 warnings when I complied demoextension project.
Quote:
c:\program files\brew sdk v2.1.3\examples\demoextension\demoextension.c(46) : warning C4133: '=' : incompatible types - from 'void (__cdecl *)(struct _DemoExtension *)' to 'int (__cdecl *)(struct _DemoExtension *)'
c:\program files\brew sdk v2.1.3\examples\demoextension\demoextension.c(47) : warning C4133: '=' : incompatible types - from 'struct JulianType (__cdecl *)(struct _DemoExtension *)' to 'int (__cdecl *)(struct _DemoExtension *)'
and When I complied demoextensionuse project the InitAppData method returns false by not creating the Instance of "demoextension".
Do you have any idea where it went wrong ???

Hi bru,
I got 2 warnings when I complied demoextension project.
Quote:
c:\program files\brew sdk v2.1.3\examples\demoextension\demoextension.c(46) : warning C4133: '=' : incompatible types - from 'void (__cdecl *)(struct _DemoExtension *)' to 'int (__cdecl *)(struct _DemoExtension *)'
c:\program files\brew sdk v2.1.3\examples\demoextension\demoextension.c(47) : warning C4133: '=' : incompatible types - from 'struct JulianType (__cdecl *)(struct _DemoExtension *)' to 'int (__cdecl *)(struct _DemoExtension *)'
and When I complied demoextensionuse project the InitAppData method returns false by not creating the Instance of "demoextension".
Do you have any idea where it went wrong ???

Brewin,
1.In demoextension.h file there are 2 lines which is for time & date. It is specified as "int", but defined as "void" in C file. So change those 2 line as follows.
// int (*DisplayTime)(DemoExtension *po);//to display time
// int (*DisplayDate)(DemoExtension *po);//to display date
void (*DisplayTime)(DemoExtension *po);//to display time
JulianType (*DisplayDate)(DemoExtension *po);//to display date
2.The demoextensionuse(DEU) is not returning because of either you have not included demoextension's(DE) clsid or DEU is not finding DE's MIF.
If you use example folder as MIF folder, then place a copy of DE's MIF or if you use DEU folder, then place a copy of DE's MIF inside DEU folder.

Brewin,
1.In demoextension.h file there are 2 lines which is for time & date. It is specified as "int", but defined as "void" in C file. So change those 2 line as follows.
// int (*DisplayTime)(DemoExtension *po);//to display time
// int (*DisplayDate)(DemoExtension *po);//to display date
void (*DisplayTime)(DemoExtension *po);//to display time
JulianType (*DisplayDate)(DemoExtension *po);//to display date
2.The demoextensionuse(DEU) is not returning because of either you have not included demoextension's(DE) clsid or DEU is not finding DE's MIF.
If you use example folder as MIF folder, then place a copy of DE's MIF or if you use DEU folder, then place a copy of DE's MIF inside DEU folder.

// int (*DisplayTime)(DemoExtension *po);//to display time
// int (*DisplayDate)(DemoExtension *po);//to display date
I changed the above 2 function to the below.
void (*DisplayTime)(DemoExtension *po);//to display time
JulianType (*DisplayDate)(DemoExtension *po);//to display date
Also placed demoextension MIF file in demoextensionuse project folder.
When I run the App I am able to see the date and time on the screen, then I pressed the END_KEY, the App closes normally, But when I closed the emulator
I got the "Access Violation" error.
Can you explain why its happening.

// int (*DisplayTime)(DemoExtension *po);//to display time
// int (*DisplayDate)(DemoExtension *po);//to display date
I changed the above 2 function to the below.
void (*DisplayTime)(DemoExtension *po);//to display time
JulianType (*DisplayDate)(DemoExtension *po);//to display date
Also placed demoextension MIF file in demoextensionuse project folder.
When I run the App I am able to see the date and time on the screen, then I pressed the END_KEY, the App closes normally, But when I closed the emulator
I got the "Access Violation" error.
Can you explain why its happening.

I dont see this behaviour with my 2.1 emulator. Did you change any code except the return type?

I dont see this behaviour with my 2.1 emulator. Did you change any code except the return type?

Hi bru,
I try to compile the demoextension and found the same error with Brewin.
I also try ur said solution about that, but still there are link errors with the following functions:
_aee_malloc
_aee_free
_aee_dbgprintf, etc...
How do I start creating the workspace for demoextension? Sorry Im not good in starting without an wizard... :D
And also, I try to fix the link error, by setting external library like BREW_Simulator.lib and its directory in the Project Setting.
I were able to compiled it. But when im try to use it in demoextensionuse,
when I trying to create an instance for demoextension, the ENOSUCH error was
return by ISHELL_CreateInstance...
Any idea? Why im receiving that error?
Thanks in advance....

Hi bru,
I try to compile the demoextension and found the same error with Brewin.
I also try ur said solution about that, but still there are link errors with the following functions:
_aee_malloc
_aee_free
_aee_dbgprintf, etc...
How do I start creating the workspace for demoextension? Sorry Im not good in starting without an wizard... :D
And also, I try to fix the link error, by setting external library like BREW_Simulator.lib and its directory in the Project Setting.
I were able to compiled it. But when im try to use it in demoextensionuse,
when I trying to create an instance for demoextension, the ENOSUCH error was
return by ISHELL_CreateInstance...
Any idea? Why im receiving that error?
Thanks in advance....

Let me give a easy way to create the project. This should help many other newbies too.
1.Create a copy of helloworld folder and rename to 'demoextension'.
2.Open a command window and go to DE folder and give the command as " ren hello*.* demoextension.* ". This should rename all the files to demoextension with its own file extension.
3.Now open demoextension.dsw in notepad(just drag drop), then rename all "helloworld" into "demoextension" and save it. Use capital letter where ever is given to maintain.
4.Next open demoextension.dsp and rename like in step 3.
5.Now copy all the DE files you have downloaded from this thread and paste in this folder.
6.Now it should compile correctly, nothing else you need to do.
Same way do that for demoextensionuse and compile.
For the ENOSUCH error, check the MIF files like I explained in first post. Also make sure demoextension.dll exist before you run DEU.

Let me give a easy way to create the project. This should help many other newbies too.
1.Create a copy of helloworld folder and rename to 'demoextension'.
2.Open a command window and go to DE folder and give the command as " ren hello*.* demoextension.* ". This should rename all the files to demoextension with its own file extension.
3.Now open demoextension.dsw in notepad(just drag drop), then rename all "helloworld" into "demoextension" and save it. Use capital letter where ever is given to maintain.
4.Next open demoextension.dsp and rename like in step 3.
5.Now copy all the DE files you have downloaded from this thread and paste in this folder.
6.Now it should compile correctly, nothing else you need to do.
Same way do that for demoextensionuse and compile.
For the ENOSUCH error, check the MIF files like I explained in first post. Also make sure demoextension.dll exist before you run DEU.

thanks, it already work...
my workspace is incorrect thats why ENOSUCH was returned by ISHELL_CreateInstance.
Again thank you very much. :)

thanks, it already work...
my workspace is incorrect thats why ENOSUCH was returned by ISHELL_CreateInstance.
Again thank you very much. :)

Hello,
I tried the demoextension code, I can compile it successfully.
But when I run it on Emulator, the emulator deletes all my files (dll and mif), even the folder, automatically.
Could anybody help me on this?
I tried emulator with both brew 2.1.3 and 3.1.5.
Thanks in advance

Hello,
I tried the demoextension code, I can compile it successfully.
But when I run it on Emulator, the emulator deletes all my files (dll and mif), even the folder, automatically.
Could anybody help me on this?
I tried emulator with both brew 2.1.3 and 3.1.5.
Thanks in advance

This is kind of weired. As far as I know emulator should not be deleting the folder, unless you have some script that deletes before starting emulator. Try any example app that came with SDK and let us know

This is kind of weired. As far as I know emulator should not be deleting the folder, unless you have some script that deletes before starting emulator. Try any example app that came with SDK and let us know

I found the reason, but I still don't understand why.
It's the mif file cause the problem.
At first, I created a new mif file and just set classID. for this kind of mif file, the emulator deletes file automatically.
Later I copied the helloworld.mif, rename it and change classID. and now it works.
Does anyone know why in the first case, emulator deletes files automatically?
Thanks,

I found the reason, but I still don't understand why.
It's the mif file cause the problem.
At first, I created a new mif file and just set classID. for this kind of mif file, the emulator deletes file automatically.
Later I copied the helloworld.mif, rename it and change classID. and now it works.
Does anyone know why in the first case, emulator deletes files automatically?
Thanks,

I am posting this to bring the thread active. If this thread is not viewed for 30 days, then it becomes inactive.

I am posting this to bring the thread active. If this thread is not viewed for 30 days, then it becomes inactive.

Hi Bru,
Your topic is very helpful. To setup the demoextensionuse on simulator (or emulator)
1. copy two mif files into the active simulator (or emulator) folder.
2. create two folders for .dll files
The idea is we have to setup the DE as normal application to make the DEU work.
It works fine for me now. Thank you very much BRU...
Thanks again,
Phuong Vo

Hi Bru,
Your topic is very helpful. To setup the demoextensionuse on simulator (or emulator)
1. copy two mif files into the active simulator (or emulator) folder.
2. create two folders for .dll files
The idea is we have to setup the DE as normal application to make the DEU work.
It works fine for me now. Thank you very much BRU...
Thanks again,
Phuong Vo

Hi Bru,
Does extionsion work if I define my classes in C++? and if I have a thousand of functions then I have declare all of them in the virtual function table?
Thanks again,
Phuong Vo

Hi Bru,
Does extionsion work if I define my classes in C++? and if I have a thousand of functions then I have declare all of them in the virtual function table?
Thanks again,
Phuong Vo

Hi all,
I just modify DE to make it work by using C++, nothing changes in DEU. If anyone is interested in, download my attached files and try.

Hi all,
I just modify DE to make it work by using C++, nothing changes in DEU. If anyone is interested in, download my attached files and try.

Thanks ppl, I got stuck with Brew Game programming book, but this helped me out a lot. Many thanks ;) :D :D :D :p

Thanks ppl, I got stuck with Brew Game programming book, but this helped me out a lot. Many thanks ;) :D :D :D :p

Hi Bru,
I compiled the code as described (hopefully). when running it on the simulator, the demoextensionuse application fails to create the instance (ISHELL_CreateInstance) of the demoextension extension. the return value is 21 (the documentation is not expecting this error to come at all). do you have an idea what happened?
i did copy the bid and h files of the demoextension to the directory of the demoextensionuse.
thanks,
yoav

Hi Bru,
I compiled the code as described (hopefully). when running it on the simulator, the demoextensionuse application fails to create the instance (ISHELL_CreateInstance) of the demoextension extension. the return value is 21 (the documentation is not expecting this error to come at all). do you have an idea what happened?
i did copy the bid and h files of the demoextension to the directory of the demoextensionuse.
thanks,
yoav

for ISHELL_CreateInstance(MYEXTENSION) iam getting a return value of 21.. what does that mean? same as Yoav re!!

for ISHELL_CreateInstance(MYEXTENSION) iam getting a return value of 21.. what does that mean? same as Yoav re!!

Can anyone help me plzzzzzzzzzzzzzzz
My extension did complied and linked well
but while integerating i got the error........
C:\Program Files\BREW 3.1.2\sdk\examples\MyFirstApp\MyFirstApp.c(1181) : warning C4013: 'IAZSearch_SetData' undefined; assuming extern returning int
C:\Program Files\BREW 3.1.2\sdk\examples\MyFirstApp\MyFirstApp.c(1183) : warning C4013: 'IAZSearch_GetResult' undefined; assuming extern returning int
........
I included .h and .bid file and make required changes in dependencies..........

Can anyone help me plzzzzzzzzzzzzzzz
My extension did complied and linked well
but while integerating i got the error........
C:\Program Files\BREW 3.1.2\sdk\examples\MyFirstApp\MyFirstApp.c(1181) : warning C4013: 'IAZSearch_SetData' undefined; assuming extern returning int
C:\Program Files\BREW 3.1.2\sdk\examples\MyFirstApp\MyFirstApp.c(1183) : warning C4013: 'IAZSearch_GetResult' undefined; assuming extern returning int
........
I included .h and .bid file and make required changes in dependencies..........

Check the macro definition for the extension...
IAZSearch_GetResult or IAZSEARCH_GetResult??? :confused:
IAZSearch_SetData or IAZSEARCH_SetData ??? :confused:

Check the macro definition for the extension...
IAZSearch_GetResult or IAZSEARCH_GetResult??? :confused:
IAZSearch_SetData or IAZSEARCH_SetData ??? :confused:

Thanks that was really helpful.........

Thanks that was really helpful.........

I am successfully able to proceed with given example , but i am getting access violation in Demoextensionuse when instance is created for demoextension
please give me solution...
boolean demoextensionuse_InitAppData(demoextensionuse *pMe)
{
pMe->m_pIShell= pMe->a.m_pIShell;
pMe->m_pIDisplay = pMe->a.m_pIDisplay;
if(ISHELL_CreateInstance(pMe->m_pIShell,AEECLSID_DEMOEXTENSION,(void **) (&(pMe->pIDemoExtension))) != SUCCESS )
{
return FALSE;
}
return TRUE;

thanks
shubhank

I am successfully able to proceed with given example , but i am getting access violation in Demoextensionuse when instance is created for demoextension
please give me solution...
boolean demoextensionuse_InitAppData(demoextensionuse *pMe)
{
pMe->m_pIShell= pMe->a.m_pIShell;
pMe->m_pIDisplay = pMe->a.m_pIDisplay;
if(ISHELL_CreateInstance(pMe->m_pIShell,AEECLSID_DEMOEXTENSION,(void **) (&(pMe->pIDemoExtension))) != SUCCESS )
{
return FALSE;
}
return TRUE;

thanks
shubhank

Thank you for your sharing.
I have build the two projects according to your guide
when i put two projects folder in the example folder, include the two .mif,
on the simulator What i see is "unkonw error(1)".
when i put the DE.MIF into the DEU folder, what i see is "Disabled the app is disabled to save space".
please help me!

Thank you for your sharing.
I have build the two projects according to your guide
when i put two projects folder in the example folder, include the two .mif,
on the simulator What i see is "unkonw error(1)".
when i put the DE.MIF into the DEU folder, what i see is "Disabled the app is disabled to save space".
please help me!

Hi all
I have followed the steps mentioned above about creating the extension and then using the same in another application.
Now when I run the demoextensionuse application, I get nothing in the screen.
Can anyone please tell me what I might be doing wrong?
Thanks a lot in advance.
Akshay

Hi all
I have followed the steps mentioned above about creating the extension and then using the same in another application.
Now when I run the demoextensionuse application, I get nothing in the screen.
Can anyone please tell me what I might be doing wrong?
Thanks a lot in advance.
Akshay

Thanks a lot bru...
This post rocks...
Looking forward to such nice post and demo codes...
One query...
Can any one please explain, why the functions in the demoextension.h are static?
Thanks

Thanks a lot bru...
This post rocks...
Looking forward to such nice post and demo codes...
One query...
Can any one please explain, why the functions in the demoextension.h are static?
Thanks

Same concept of C language. Static function restricts visibility of the function to the translation unit in which it's declared. Functions are implicitly declared as extern by default, which means they're visible across translation units.

Same concept of C language. Static function restricts visibility of the function to the translation unit in which it's declared. Functions are implicitly declared as extern by default, which means they're visible across translation units.