Writing Modules In C

From ASSS Wiki
Revision as of 17:43, 10 January 2005 by BaK (talk | contribs)
Jump to: navigation, search

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?) /*<br> Template Module<br> */<br> <br> #include "asss.h"<br> <br> // Interfaces<br> local Imodman *mm;<br> // The entry point:<br> EXPORT int MM_testModule(int action, Imodman *mm_, Arena *arena)<br> {<br> if (action == MM_LOAD)<br> {<br> mm = mm_;<br> return MM_OK;<br> }<br> else if (action == MM_UNLOAD)<br> { <br> return MM_OK;<br> }<br> else if (action == MM_ATTACH)<br> { <br> return MM_OK;<br> }<br> else if (action == MM_DETACH)<br> {<br> return MM_OK;<br> }<br> return MM_FAIL;<br> }<br>