Home User Guide Dll PLugins Dll code skeleton
11 | 12 | 2017
Dll code skeleton

Dlls for mm2k6 are extremely similar to dlls for mm console and mm2000. The basic skeleton can be the same for all of them. All of them require a proc called Version and alll of them use the same callback to return commands to the client. 


// These lines should be placed in yourdll.h file
#define DllExport   __declspec( dllexport )

typedef VOID (*MMINTERPCALLBACK)(const char *);

// Pointer to the Interpreter Function of Mudmaster.

// Create a DLL project in VC and add this stuff into yourdll.cpp.

// This function is required by MM. This is how it determines if it is a
// mm2k6 Dll.
// What you send in the calback _pInterpFunct is used as a command.
extern "C" DllExport void Version(const char *pszParams, char *pszResult)
    // What you stick into pszResult is what you see with /dll in MM.

    strcpy(pszResult,"Map, v0.6");


// This is an option function you can add to the dll. If this function exists
// MM calls it and gives it a pointer to the interal interpreter. You can
// then use this pointer to make MM do stuff.
extern "C" DllExport void CallbackAddress(MMINTERPCALLBACK pFunc)
      _pInterpFunc = pFunc;

      // With this pointer you can do....
      // _pInterpFunc("/showme {hello from the dll}");

// This is an example of how you delcare a function for the DLL.
// You can do "/calldll DllName myProc" to call it.
// Anything passed after into the DLL is in "pszParams"
// mm2k6 will  deal with stick in "pszResult" but use _pInterpFunc("command to execute").

//pszResult may be deprecated at some point

extern "C" DllExport void myProc(const char *pszParams, char *pszResult)
      // Pointless, but shows you what it does.
      // This sends a showme back to mm2k6.
      _pInterpFunc("/showme {You call the myProc procedure of the dll}";

     //the *pszResult is there mostly to be backwards compatible.