[Scummvm-devel] Question regarding DC plugins
Johannes Schickel
lordhoto at scummvm.org
Thu Aug 20 17:02:52 CEST 2009
yotam barnoy wrote:
> I have a question about the DC plugin implementation, which I'm trying
> to adapt for the PSP.
>
> Specifically, I'm not sure how the ld command line parameters work.
> --retain-symbol-file is supposed to get rid of all symbols not
> mentioned in the plugin.syms file. How then can the executable call
> anything in the shared object file except for loadPlugin, pluginName etc.?
The ScummVM binary only uses the functions: "PLUGIN_getVersion",
"PLUGIN_getType", "PLUGIN_getTypeVersion" and "PLUGIN_getObject" no
function symbol otherwise need to be imported from the plugins.
What the ScummVM binary does is:
-> load the plugin
-> call PLUGIN_getVersion to check for the plugin API implemented
-> call PLUGIN_getType to determine the type of the plugin
-> call PLUGIN_getTypeVersion to determine the version of the specific
plugin type the plugin implements
-> call PLUGIN_getObject, which returns a pointer to a class object
The class object returned by "getObject" does contain virtual functions,
which the specific plugin has to implement. The addresses of the virtual
functions are saved in the vtable of the returned object, so there is no
need to export the symbol names for those.
That's why only the above listed functions are needed. It seems the DC
does export the constructor and destructor specific symbols, so it can
access them to call all constructors / destructors of 'global' variables
in the given plugin.
// Johannes
More information about the Scummvm-devel
mailing list