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

  • From: Paul Davis <paul@xxxxxxxxxxxxxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Mon, 07 Feb 2005 20:53:56 -0500

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


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: