Brew advanced and proficient-3G mobile value-added business operation, customization and Development serialized 85--brew extension class development

Source: Internet
Author: User

Extension classes are not used as independent applications, and mobile users cannot directly purchase, download, or delete them. Instead, they are processed in the internal environment of the application that uses the extension class. The extension class is a special application, which is equivalent to the library developed by the application developer. It is represented as a dll library on the PC and a mod execution file on the terminal.

There are two types of Extension applications: public extension and private extension. Public extension classes are developed and owned by developers and are provided to other developers for use and are charged. Private extension classes can be developed and owned by developers, used by one or more of their own applications, and shared with other applications. They can also be developed and owned by operators and released by carriers, provided to developers or partners. It can also be developed and owned by mobile phone manufacturers, released by mobile phone manufacturers, and used by partners.

When creating an extension class, pay attention to the implementation order. First, allocate memory, initialize the virtual table, and finally initialize the member variables and other required code. The example is as follows:

If (nsize <sizeof (myextension) nsize + = sizeof (myextension );

If (PME = (myextension *) malloc (nsize + sizeof (vtbl (imyextension) = NULL)

Return enomemory;

// Initialize the data members

PME-> m_nrefs = 1;

PME-> m_mydata1 = 0;

PME-> m_mydata2 = 0;

The implementation of other functions in the extension class is the same as that in common applications.

When using an extended class, it is equivalent to calling an interface. You only need to include the header file of the extended class, and then create an interface instance of the extended class to use the functions in the extended class normally. For example:

If (ishell_createinstance (PME-> m_pishell, aeeclsid_myextension, (void **) & pextcls ))

Return false;

Iextcls_myfunction1 (pextcls, 0 );

Iextcls_release (pextcls );

The communication between an application and an extension class is similar to the communication method between the application discussed earlier.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.