Open main menu

Difference between revisions of "HOWTO-Dynamic Modules"

m
no edit summary
m
m
Line 6: Line 6:


I will assume that you are at least roughly familiar with ScummVM, and have a fresh checkout of our Subversion repository. Note that it's strongly advised to base your work on the current development version of ScummVM, and not on a release version. This will ease integration of your work.
I will assume that you are at least roughly familiar with ScummVM, and have a fresh checkout of our Subversion repository. Note that it's strongly advised to base your work on the current development version of ScummVM, and not on a release version. This will ease integration of your work.


=== Overview ===
=== Overview ===


ScummVM has a PluginManager class that potentially keeps track of multiple plugin providers. As of this writing, a StaticPluginProvider is always added to this PluginManager that keeps track of all statically-linked plugins. Your job will be to add a dynamic plugin provider specific to the backend you're working on that will provide for any dynamic plugins that are enabled on that backend and to tell the backend to use this provider in the case that dynamic modules are enabled.
ScummVM has a PluginManager class that potentially keeps track of multiple plugin providers. As of this writing, a StaticPluginProvider is always added to this PluginManager that keeps track of all statically-linked plugins. Your job will be to add a dynamic plugin provider specific to the backend you're working on that will provide for any dynamic plugins that are enabled on that backend and to tell the backend to use this provider in the case that dynamic modules are enabled.


=== Step by step ===
=== Step by step ===
Line 24: Line 22:
# Modify the build system for your backend (See "Necessary Build Modifications" below).
# Modify the build system for your backend (See "Necessary Build Modifications" below).
# Cross your fingers and be prepared to work at things for a while if it doesn't immediately function ;-)
# Cross your fingers and be prepared to work at things for a while if it doesn't immediately function ;-)


==== Example of foobar-provider.h====
==== Example of foobar-provider.h====
Line 48: Line 45:
#endif // defined(DYNAMIC_MODULES) && defined(FOOBAR)
#endif // defined(DYNAMIC_MODULES) && defined(FOOBAR)
</syntax>
</syntax>


==== Making the plugin linker script for your backend ====
==== Making the plugin linker script for your backend ====
Line 77: Line 73:
}</syntax>
}</syntax>
*That's it! If you have trouble with any of these instructions or need to further modify the linker script for something specific to your platform, see [http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gnu-linker/scripts.html] for linker script documentation and peruse the various <tt>plugin.ld</tt> files in the subdirectories of <tt>backends/plugins/</tt>. TODO: Add stuff about MIPS-specific linker script modifications, namely the "shorts" segment.
*That's it! If you have trouble with any of these instructions or need to further modify the linker script for something specific to your platform, see [http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gnu-linker/scripts.html] for linker script documentation and peruse the various <tt>plugin.ld</tt> files in the subdirectories of <tt>backends/plugins/</tt>. TODO: Add stuff about MIPS-specific linker script modifications, namely the "shorts" segment.


==== Necessary Build Modifications ====
==== Necessary Build Modifications ====
Line 95: Line 90:


TODO: Add stuff about "ONE_PLUGIN_AT_A_TIME" once it is working perfectly.
TODO: Add stuff about "ONE_PLUGIN_AT_A_TIME" once it is working perfectly.


==== Subclassing DLObject ====
==== Subclassing DLObject ====
27

edits