New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin support #1328
base: master
Are you sure you want to change the base?
Plugin support #1328
Conversation
Why not add the flags to the Makefile for the submission? |
There, the configure script does the flags for Makefile now. |
…hatever size it needs to be to handle the number of plugins. Also added further error checking to the various for-loops.
Now allocates memory for the array on a needs basis as it finds more plugins to load instead of defaulting the array size to only allowing 100 max |
I haven't really looked at the code yet, but I'd like to see a more robust interface for this, particularly with some kind of versioning for future-proofing so more features can be added and we can tell what level of support any given plugin provides. It would also be nice if plugins had a method to report their own name, plugin version, interface version, etc, that could be displayed somewhere (probably in something like |
…t need to go backwards, but it's an easy thing to implement.
Have switched to using a doubly linked list instead of the array. Will look at a better way of handling the plugins that support certain features, especially the timer feature, it's not really a problem when you only have 1 or 2 plugins, but if you have lots of plugins, it would be handy if the penn local_timer() knew ahead of time exactly which plugins to target instead of going through the entire linked list each time. |
Will look at the version support later on, for now the basics :) |
…that were in local.c
…_register_loop(), move unloading of plugins from local.dst:local_shutdown() to bsd.c:unload_plugins(). Plugin management will eventually need to be moved to a new file called plugins.c, and with minor changes to necessary penn files for loading, unloading, etc...
…file not marked as 'extern' where the header file is included in multiple source files will return a 'Multiple definitions' error.
…at in bsd.c since for now bsd.c is the only file that cares about it.
…stead, that way it doesn't conflict with Penn's own next_token() function.
The latest PR should never have happened :) I was trying to figure out Githubs changes since I last actively used it for doing commits, etc... |
Closing for now. I dislike the fact that the PR keeps getting updated everytime I push a change. |
…s particular plugin
… plugin for the particular system it is running on
…hat way we don't get implicit declaration warnings.
…'t be since d->name is set at 256 internally) we bail out
…ry configurable in mush.cnf
…cription and long description. Start of @plugin/list command.
… called by cmd_plugin. Loop through the plugins directory so that each plugin can show whether it has been loaded into the game or not.
… so that they can be used by load/unload/reload and initial starting up/@shutdown/reboot
…ce warnings. Fix up do_real_unload_plugin as it wasn't removing the plugin from the hashtab due to using the wrong key. Finish implementing @plugin/reload and @plugin/unload.
Start of implementing @plugin/load <.so file>
…e ID of the plugin.
Update do_real_load_plugin so that it returns a success or fail to denote if the plugin was loaded or not so that @plugin/load can provide feedback.
…en, also changes to the example math plugin to work on FreeBSD.
…or(), that way in cases where we are manually loading the plugin, we can display the error to the executor of @plugin/load
…e a plugin inactive is to unload it.
…nce all the plugin ids, that way it remains 1...n instead of having gaps.
…, then looping through the plugins directory where we have to eventually hashfind() anyway, just loop through the plugins directory and hashfind() on each file found.
…n/list. Move resequence_plugin_ids() so that it is defined before it is used.
It's kinda rough.
Needs a directory in the rootdir called 'plugins', all works though.
Also needs 3 flags added to root/Makefile:
2 in LDFLAGS:
-Wl,--unresolved-symbols=ignore-in-object-files
-rdynamic
1 in CLIBS:
-ldl
An example test plugin:
Test plugin is compiled by doing
in the plugins directory.
At that point you can either start up your game or @shutdown/reboot your game.
Plugin requires a 'plugin_init()' function, and can optionally have a 'plugin_timer()' function if you need to run something in your plugin every second.