Click here to Skip to main content
15,898,010 members
Articles / Programming Languages / C++

DynObj - C++ Cross Platform Plugin Objects

Rate me:
Please Sign up or sign in to vote.
4.95/5 (34 votes)
27 Sep 200727 min read 147.6K   3.4K   132  
DynObj is an open source library that provides a C++ application with run-time class loading facilities
#ifndef COMPILER_H
#define COMPILER_H

#include "platform.h"

// Detect compiler

#ifdef __GNUG__
#define PI_COMPILER "g++"
#define PI_COMPILER_ __GNUG__
#define PI_COMPILER_VERSION_MINOR __GNUC_MINOR__
#define GNU_INLINE_ASM

#elif __GNUC__
#define PI_COMPILER "gcc"
#define PI_COMPILER_ __GNUG__
#define PI_COMPILER_VERSION_MINOR __GNUC_MINOR__
#define GNU_INLINE_ASM

#elif _MSC_VER
#define PI_COMPILER "VisualC"
#define PI_COMPILER_ _MSC_VER
#define MSVC_INLINE_ASM

// Fill in for other compilers
//#elif 
#else
    #error Compiler not recognized
#endif // __GNUG__

#ifndef PI_COMPILER_VERSION
#define PI_COMPILER_VERSION PI_COMPILER_
#endif

#ifndef PI_COMPILER_VERSION_MINOR
#define PI_COMPILER_VERSION_MINOR 0
#endif


#if defined(GNU_INLINE_ASM)
    #define GET_FRAME_PTR(var) \
    __asm__ __volatile__ ( \
		"mov %%ebp, %0 \n" \
		: "=a"(var)        \
    );
    
#elif defined(MSVC_INLINE_ASM)
    #define GET_FRAME_PTR(var) \
    __asm{             \
		mov var, ebp   \
    }

#endif // GNU_INLINE_ASM

#ifdef GNU_INLINE_ASM
    #define GCC_COMPATIBLE
#endif

#ifdef MSVC_INLINE_ASM
    #define MSVC_COMPATIBLE
#endif


#endif // COMPILER_H

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions