[gmpi] Re: low level API - Abstract Factory summary

  • From: Jeff McClintock <jeffmcc@xxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Tue, 08 Feb 2005 13:49:22 +1300

simple explanation of COM..

for every C++ member..

float GMPI_Plugin->DoSomething(int arg1);

...there is an equivalent plain-C function...

float DoSomething( GMPI_Plugin*, int arg1 );

i.e. pass the object pointer as the first argument.

COM cleverly takes advantage of the fact that at a binary level. The two are *identical* (provided some conditions are met).

-functions must use standard calling convention ( __stdcall )
-only virtual functions allowed

COM allows you to write plugins using familiar C++, provided you meet those conditions. To clarify which functions are visible from the host, the convention is for each class, extract all it's virtual functions to a base-class prefixed with "I".

  virtual int func1();
  float func2();
  int a;

get disected into 2..

  virtual int func1() = 0;


MyClass : public IMyClass
  virtual int func1(){return 23;};
  float func2();
  int a;


---------------------------------------------------------------------- Generalized Music Plugin Interface (GMPI) public discussion list Participation in this list is contingent upon your abiding by the following rules: Please stay on topic. You are responsible for your own words. Please respect your fellow subscribers. Please do not redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: