Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Getting Started

nickelc edited this page Nov 27, 2019 · 38 revisions

This page explains how to setup mod.io SDK into your game. Visual C++ and MinGW are supported for Windows, GCC for Linux and Clang for MacOS. Also, you can take a look at our Sample Projects showing the minimum setup required to start using mod.io on specific compilers.

Step 1: Download the SDK

Download the latest version of the SDK from the github releases page or from the mod.io website, it provides all the files needed to integrate mod.io into your game or modding tool.

Step 2: Link the Libraries

Windows Visual C++

Link the provided import library libmodio.lib and place all the libmodio.dll next to your executable. The import library is located at lib/visualc++/ and the DLL at bin/visualc++/.

Note: You will need to install the Visual C++ Redistributable for Visual Studio in order to use the mod.io Visual C++ libraries.

Windows MinGW

Link the provided import library libmodio.a and place all the libmodio.dll files next to your executable. The import library is located at lib/mingw/ and the DLLs at bin/mingw/.

Note: mod.io is compiled using C++11 so you will need to add the -std=c++11 compiler flag.

Linux GCC

mod.io SDK uses LibCurl and Zlib. Usually, they are already present on your Linux distribution. If it's not the case, install them using your package manager:

    apt-get install g++ libcurl4-openssl-dev zlib1g-dev

Link the the provided shared library libmodio.so located in the lib/linux/ directory.

Note: mod.io SDK is built using C++11 so you will need to add the -std=c++11 compiler flag.

MacOS

Install Clang shipped with the XCode build essentials. This will install all mod.io SDK dependencies so no additional setup is required.

Link the the provided shared library libmodio.dylib located in the lib/osx/ directory.

Note: mod.io SDK is built using C++11 so you will need to add the -std=c++11 compiler flag.

Step 3: Include the Headers

Add the provided include/ directory to your compiler's include path.

Step 4: Initialize mod.io SDK

That's it! Once you have initialized the SDK instance, you should be able to use all the mod.io functionality on your project.

#include "modio.h"

int main()
{
  modio::Instance modio_instance(MODIO_ENVIRONMENT_TEST, 7, "e91c01b8882f4affeddd56c96111977b");
  return 0;
}

Now that mod.io has been integrated into your project, please refer to the mod.io documentation and Code Samples in order to customize your integration.

Compliation Examples

The following are complete Makefile examples that shows how to link and import mod.io SDK into your project.

Visual C++

#Makefile
#run with the 'nmake' command

CC = cl.exe
CFLAGS = /EHsc /MD

build:
	$(CC) $(CFLAGS) main.cpp modio.lib /I include

MinGW

#Makefile
#run with the 'MinGW32-make.exe' command

CC=g++
CFLAGS=-Wall -std=c++11

all: main.cpp
	$(CC) $(CFLAGS) main.cpp -o example -I ./include libmodio.dll.a

GCC

#Makefile
#run with the 'make' command

CC=g++
CFLAGS=-Wall -std=c++11

all: main.cpp
	$(CC) $(CFLAGS) main.cpp -o example -I ./include libmodio.so -lcurl -Wl,-rpath .

Clang

#Makefile
#run with the 'make' command
CC=clang++
CFLAGS=-Wall -std=c++11

all: main.cpp
	$(CC) $(CFLAGS) main.cpp -o example -I ./include libmodio.dylib -Wl,-rpath .

Static linking

Static binaries are also provided under the static/ lib directory. The following adjustments should be made when compiling statically.

Windows

  • Define the MODIO_STATICLIB and CURL_STATICLIB preprocessor flag. Under Properties > C/C++ > Preprocessor Definitions
  • Link the following dependencies from the base visual studio libraries ws2_32.lib;wldap32.lib;advapi32.lib;kernel32.lib;comdlg32.lib;crypt32.lib;normaliz.lib. (Under Properties > Linker > Input > Additional Dependencies)
  • Link the following dependencies provided by the SDK lib/MSVC/x86/libcurl_a.lib and lib/MSVC/x86/zlib.lib. (Again under Properties > Linker > Input > Additional Dependencies)

Linux and MacOS

  • Link curl and zlib by adding the following link flags: -lcurl and -lz.

Contents

Clone this wiki locally