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

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

> are you sure that this in keeping with the C++ standard, rather than
> just being something that works with MS compilers?

If you use the plain-C version.  It's 100% standard.

If you use the optional C++ shortcut, it's not 'standard' C. I can't find a list of compilers that support the shortcut. Mozilla is based on COM though, and the list of platforms they support is *extensive*. so they must be pretty happy. All I can find on the Mozilla site is a reference to "any decent compiler".

Should we write the low level in plain-C (in the COM style)?

Either way, we can design in C++, knowing that with COM the conversion to plain-C is routine (object pointer inserted as 1st arg)..

Best Regards,
jeff






Paul Davis wrote:
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".


are you sure that this in keeping with the C++ standard, rather than
just being something that works with MS compilers?

for example, just recently an issue came up in the gtkmm project (a
GUI toolkit for X Window and win32; porting very slowly to OSX) where
there was an attempt to pass ptrs to static member functions of a C++
object as callback functions to a C interface. most people i know
(well, OK, myself) tend to regard static member functions as
equivalent to regular C functions - no "this" pointer and all that.

a solaris compiler complained about this, and so it had to be checked
against the standard. it turned out that the compiler was correct. all
C++ functions have "C++ linkage" and even if their low level calling
convention is identical with C, they cannot be converted to "C
linkage" without a lot of (dirty) work on the part of the programmer,
if at all.

this is not the same situation as you describe for COM. but i just
have a bad feeling about the assumption that you can write a single
interface and assume that it works for C and C++
"natively". obviously, any C interface (more or less) can be in C++
but only in the "C-like" way. This is part of the reason that a number
of us insisted on C as the implementation language for the spec.

--p


---------------------------------------------------------------------- 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




----------------------------------------------------------------------
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: