Developer information

This section contains information for developers that want to modify or add to the Grendel sourcecode.

Modules

As of 0.4.0, the Grendel sourcecode contains so called 'modules'. These modules (or plugins, if you will) can be loaded on demand by the server, and can contain arbitrary functionality that you may wish to enable.

It also provides a more suitable platform for 3rd party code, which will rely less on the core functionality, and thus better survive the rough tide of code improvements and version changes.

Modules are built and loaded through the native Delphi package mechanism, and as such they are simply "enhanced" DLL's (or shared libraries).

There are however a few guidelines and requirements for these modules:

  • Each module should have a unique name. If in doubt about the name of your module, contact the developers

  • Compiled modules should be placed in the modules directory

  • Add a {$DESCRIPTION} line in the .dpk file of the module, with a small description of the functionality of the module

  • Make sure the units in the module do not collide with units in any other module. Good common practice is to prefix all units with an abbreviation of the modulename

Each module should define a class which implements IModuleInterface, and export that class, as per the following example.

Example 6. Implementing IModuleInterface

type
	GExampleModule = class(TInterfacedObject, IModuleInterface)
	published
		procedure registerModule();
		procedure unregisterModule();
	end;

procedure GExampleModule.registerModule();
begin
	{ perform some initialization here }
end;

procedure GExampleModule.unregisterModule();
begin
	{ perform some cleanup here }
end;

function returnModuleInterface() : IModuleInterface;
begin
	Result := GExampleMudModule.Create();
end;

exports
	returnModuleInterface;