Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Frequently asked questions

What are the differences between an extension and a service?

Extensions and services are two orthogonal concepts. One corresponds to the type of software module and the other corresponds to the type of class the software module contains. See the table below. An extension is a software module that does not implement the applet class, so it can only be loaded and executed by Brew MP when it is called by an application. It is similar in concept to software plugins in the PC world. A service is a type of Brew MP class. See the Classes section for more details.

Brew MP Class types Supporting Module Formats Applicable Brew MP Software Module Supporting IDE Wizards
Applet Class MOD or MOD1 Application Application (Applet Class)
In-Process Class MOD or MOD1 Application or Extension Extension (In-Process Class)
Service Class MOD1 Application or Extension Through "Add->Class->Service Class"
  • Brew MP class types: To write C/C++ programs in Brew MP is to implement three types of Brew MP Classes: applet class, in-process class, and service class
  • Supporting module formats: There are two types of module formats supported by Brew MP that contain one or more Brew MP classes, MOD and MOD1. MOD can only contain applet and in-process classes and MOD1 can contain all three types of classes. For more information on MOD and MOD1, see the MOD vs. MOD1 in Brew MP Technology Guide in http://developer.brewmp.com/resources on the Brew MP website.
  • Applicable Brew MP software modules: A Brew MP application is a software module that contains at least one applet class so that it can be loaded and executed directly by Brew MP. A Brew MP extension is a software module that contains only non-applet classes and therefore can only be loaded and executed by Brew MP when it is called by a Brew MP application.
  • Supporting IDE Wizards: Wizards are provided by the Brew MP IDE plugins to assist developers in auto-generating code for Brew MP classes in specified module formats. Currently, there are two wizards available for C Applications and C Extensions. The C Application wizard generates code for an applet class in MOD or MOD1 format. The C Extension wizard generates code for an In-process class in MOD or MOD1 format.

What's the relationship between and an applet and an application?

An applet is a Brew MP class that supports IApplet. It can be loaded and executed by BREW Shell and receive BREW EVT_XX events. An application is a software module that contains at least one applet class that can be loaded and executed by Brew MP. An application may also contain any number of in-process or service classes. Please see the Classes section for more details.

What are the differences between an in-process class and a service class?

An in-process class is a class that can only be instantiated in the process (or more specifically, the same Env) of the caller. A service class is a class that is instantiated in a designated process (specified in the CIF in which the service class is declared). A service class must support one or more interfaces that are remotable because the caller may call from a different process than the service object. For more information, see the Classes section, and the Resource Files and Markup Reference document in http://developer.brewmp.com/resources on the Brew MP website.

Why should I use a service class instead of an in-process class?

  • To be instantiated and protected in a designated process rather than in the caller's environment, as is the case for an in-process class.
  • To be preemptively multi-threaded.
  • If you manage shared data between clients and manage access to shared resources.

How does an applet interact with a service or an in-process class?

An applet calls IShell_CreateInstance() or IEnv_CreateInstance() to instantiate an in-process or a service class. When an applet interacts with an in-process class, all the function calls are direct invocations because they are in-process. When an applet interacts with service classes, the calls are remote invocations because service objects are not in the same context or environment of the calling applet. See the Classes section for more information.

How does an applet interact with another applet?

Applets can only "start" another applet by calling IShell_StartApplet() or related APIs, but not by calling IShell_CreateInstance() or IEnv_CreateInstance(). The applets interact with one another by posting events (for example, using IShell_PostEvents()), shared files (permitted in FS_ACL_Grant in CIF), IFIFO IPC communication (permitted in FIFO_ACL_Grant in CIF), or a singleton service object, etc.

How are resources tracked and managed by applet, in-process, and services classes?

Resources that are loaded by an in-process class are always loaded in the context, and share the privileges of, the invoking application. Memory allocated as a result of resource loading is always tracked in the context of that application. In-process objects loaded by one application or extension in one process should not be sent to another application in a separate process (e.g. IShell_SendEvent()) since it is unsafe and violates the memory protection boundary. Applet and service objects have their own sets of privileges and are hosted in their designated processes for their own resource tracking. Remotable objects can be passed between service objects or between a service and an applet across process boundaries.

Why should I create a Brew MP extension instead of an application?

An application can be loaded and executed directly by Brew MP like any executable in the PC world. An extension is similar to a code extension or software plugin. Extensions can be re-used by various applications so the code doesn't need to be duplicated or re-implemented in the module of each using application.

Can I package an applet class, an in-process class, and a service class into a single module?

Yes. Extensions and applications are essentially software modules or repositories of classes. An application has at least one applet class and any number of in-process and/or service classes. An extension can have any number of in-process and/or service classes but cannot contain applet classes. Currently, if the application or extension is to be distributed through QIS BDS, applet classes and non-applet classes must be in separate modules. This is a BDS restriction rather than a Brew MP restriction.