Writing Modules In C: Difference between revisions

From ASSS Wiki
Jump to navigationJump to search
D1st0rt (talk | contribs)
formatted code
D1st0rt (talk | contribs)
mNo edit summary
Line 1: Line 1:
The easiest way to write a module in C is to work off a template, as certain parts of all modules are identical. Here is a template that does nothing more than connect with the server:
The easiest way to write a module in C is to work off a template, as certain parts of all modules are identical. Here is a template that does nothing more than connect with the server:


(TODO: How do I format code?)
 
<pre>/*
<pre>/*
Template Module
Template Module

Revision as of 22:03, 10 January 2005

The easiest way to write a module in C is to work off a template, as certain parts of all modules are identical. Here is a template that does nothing more than connect with the server:


/*
	Template Module
*/

#include "asss.h"
// Interfaces
local Imodman *mm;

// The entry point:
EXPORT int MM_testModule(int action, Imodman *mm_, Arena *arena)
{
	if (action == MM_LOAD)
	{
		mm = mm_;
		return MM_OK;
	}
	else if (action == MM_UNLOAD)
	{	
		return MM_OK;
	}
	else if (action == MM_ATTACH)
	{		
		return MM_OK;
	}
	else if (action == MM_DETACH)
	{
		return MM_OK;
	}
	return MM_FAIL;
}