Creating and Testing a Simple Discretion Module in Eclipse

From ASSS Wiki
Revision as of 02:01, 16 March 2008 by BaK (talk | contribs) (content)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This tutorial is a video tutorial describing how anyone can using minGW (and probably g++) and Eclipse to compile a simple module and put get it to run on Discretion. It assumes you're using Windows (although g++ may work) and you don't have any tools installed. However, you should have already gotten the source code (if not see the Obtaining the Discretion Source using Subversion tutorial). This tutorial is part of a series of tutorials consisting of the Discretion Module Tutorial.

minGW stands for minimalistic Gnu for Windows. It is an open source complier almost identical to gcc and g++, which are the compilers used for linux, among other things. The compiler produces native Windows exectuables, and best of all it's free! However, its interface isn't the best for the novice user. Thus, we use eclipse to help manage the minGW compiler for us.

Eclipse, is an integrated development environment (IDE) which is also open-source and free. It is basically a program that makes it easier to make other programs. It was originally designed for Java development, but people made plugins to allow C++ development. These extensions are called the CDT (C/C++ Development Tooling). The CDT integrates nicely with minGW so these two make a good match. Discretion's modules come with Eclipse Projects when you get the source so modifications are easy to make. Eclipse is implemented in Java, so in order to use it you need the Java Runtime Environment. The good news is you probably already have this installed. Nonetheless, the tutorial covers downloading it if you don't already have it installed.

Videos

This tutorial is divided into three parts:

  • Obtaining and Testing minGW
  • Getting the Java Runtime Environment (90% of people can skip this step)
  • Downloading Eclipse with CDT
  • Creating and Testing a Simple Module within Discretion


Links

minGW: File List

java runtime environment: Downloads

eclipse: Downloads


Code

// Sample Discretion Module Source File
#include "Module.h"

void* getClassInstance(void* _mm, LoadMode lm)
{
	if (lm == LOADMODE_Init)
		printf("Test Module Initialized\n");

	return 0;
}

extern "C" 
{
	EXPORT void* getInstance(void* mm, LoadMode lm)
	{
		return getClassInstance(mm,lm);
	}
}