[gmpi] Re: ABI's / Nutshell

On Thu, Feb 24, 2005 at 01:55:36PM -0800, Chris Grigg wrote:
> Every package file has exactly one factory function, whose offset 
> into the package file is itself found at a known offset.  To 

As stands today:

Every package file has a single entry point which is a well-known symbol.
That entry point is a function which returns a pointer to a IGMPI_Factory
"object".  IGMPI "objects" are really an ANSI C struct with a pointer to a
table of ANSI C functions.

This makes these "objects" usable from any language that can wrap C.

> instantiate a plug product, the host loads the package file into 
> memory and executes its factory function, passing in the GUID of the 
> desired plug product; factory allocates and initializes any static 

To instantiate a plugin, the host calls a method of the IGMPI_Factory
"object", passing a GUID.  The resulting "object" is an IGMPI_Unknown.
The IGMPI_Unknown "object" can be queried for compliance with the
GMPI_Plugin interface.

In practical terms, this means that you can't assume that a DLL complies
with any specific GMPI interface unless you ask it explicitly.

When the host is done with an "object", it call the release method of that
"object" (a well-known offset into the function table of that "object").
Once released, the caller may not use the "object" anymore.

> b) How exactly does the factory, or a plug, call back into the host 
> for services like memory, files, etc.?  Doesn't the factory need a 
> bundle of host callback function pointers too?

I assume that, eventually, the host will pass an "object" to the plugin.
The host "object" will have functions to do stuff.

> c) Is the plug prohibited from calling anything outside itself (other 
> than the host-provided services callbacks)?  If not, since we aren't 
> using a dynamic linker to load plugs, how exactly are those symbols 
> (system lib calls etc.) resolved by the time the plug needs to call 
> them?

If a plugin needs libraries beyond the standard C++ runtime or C runtime,
it should link them itself.  It's safest to statically link them into the
plugin.

Example:  if my plugin requires libfoo v3.14, I should statically link
libfoo v3.14 into my plugin, so I don't get version mismatch.
Alternatively, I can dynamically load another shared lib.

Does any of this happen automatically?  I don't know, nor do I know if it
is cross-platform.

Does that clarify?

----------------------------------------------------------------------
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: http://www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: