Marmalade support

How to integrate with the Marmalade SDK

Marmalade is a SDK that enables you to write games for the IOS and Android using Native C++. It is not a game engine, although it includes graphic libraries and other tools. As Marmalade can compile Native C++, it can compile RakNet and therefore enable you to use RakNet on those platforms in a consistent way.

Step 1 - Download Marmalde:

Download and install Marmalade Beta 5.1 or later. This requires registration and other steps with Marmalade.

Step 2 - Create RakNet solution:

Assuming you have RakNet downloaded, go to DependentExtensions\Marmalade and double click RakNet.mkb. If Marmalade is installed correctly, this will create a directory build_raknet_vc9 or similar. If necessary to add or remote RakNet source files, edit in a text editor the .mkb and .mkf files where the RakNet source files are listed and double click the .mkb again.

Step 3 - Build RakNet library:

Find the .sln solution file in the directory created in step 2. Open it, and build for all platforms you care about. Build / batch build / select all / build will do this as well. Assuming this worked, you will now have object files created in a directory such as DependentExtensions\Marmalade\build_raknet_vc9\Debug_RakNet_vc9_x86

Step 4 - Link RakNet to your application:

Add these two lines to your application .mkb file

option module_path="../../DependentExtensions/Marmalade"
subproject RakNet

The path under option module_path should modified to point to wherever you installed RakNet. There is an example of this under Samples\Marmalade . After doing so you will need to double click the .mkb file to regenerate your project solution.

If, upon building RakNet, you get a build error "unresolved external symbol _strtoull ..." then you need to either update Marmalade to a newer version, or comment out the last strtoull in RakNetGUID::FromString in RakNetTypes.h, then build step 3 again.

Step 5 - Fix allocator:

The Marmalade bucket system is not threadsafe. Be sure you have this code in main()

    #include "RakMemoryOverride.h"

    void* MarmaladeMalloc(size_t size)
    {
    	return s3eMallocBase(size);
    }
    void* MarmaladeRealloc(void *p, size_t size)
    {
    	return s3eReallocBase(p, size);
    }
    void MarmaladeFree(void *p)
    {
    	s3eFreeBase(p);
    }
    SetMalloc(MarmaladeMalloc);
    SetRealloc(MarmaladeRealloc);
    SetFree(MarmaladeFree);

See Also

Index