Mercurial > projects > hoofbaby
view src/dtypes.h @ 0:3425707ddbf6
Initial import (hopefully this mercurial stuff works...)
author | fraserofthenight |
---|---|
date | Mon, 06 Jul 2009 08:06:28 -0700 |
parents | |
children |
line wrap: on
line source
/** * Hoofbaby -- http://www.dsource.org/projects/hoofbaby * Copyright (C) 2009 Robert Fraser * * This program is free software; you can redistribute it andor * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef _DTYPES_H #define _DTYPES_H #ifdef _MSC_VER #pragma warning (disable : 4098) // void function returning a value #endif //------------------------------------------------------------------------------ // D Types #ifdef __D #define D_CONST #define D_LINT int #define D_LUINT uint #define D_LONG long #define D_ULONG ulong // C/C++ Types #else #define D_CONST const #define D_LINT long // int masquerading as a long #define D_LUINT unsigned long // unsigned int masquerading as an unsigned long #define D_LONG __int64 #define D_ULONG unsigned __int64 #endif //------------------------------------------------------------------------------ // Defintitions for exposing functions via a DLL // Use "FUN(name, return type, parameters)" to export a function defined elesewhere from your DLL // Try to expose only what's needed, since only exposed stuff will be linked in #define UNDERSCORE(__X__) _##__X__ #ifdef __D #define __STRINGIFY(__X__) __STRINGIFY2(__X__) #define __STRINGIFY2(__X__) #__X__ #define FP_TYPE(__RV__, __PARAMS__) __RV__ function __PARAMS__ #define FUN(__NAME__, __RV__, __PARAMS__) __STRINGIFY(FP_TYPE(__RV__, __PARAMS__)), #__NAME__, #define EXPORT(__NAME__, __RV__, __PARAMS__, __PNAMES__) FUN(UNDERSCORE(__NAME__), __RV__, __PARAMS__) #define BEGIN_DFUNCTIONS(__LIBNAME__) mixin(shared_mixin(__LIBNAME__, [ #define END_DFUNCTIONS "", ""])); #define D_ENUM(__NAME__) alias int __NAME__; \ enum : __NAME__ #else #ifdef __cplusplus #define _EXTERN extern "C" #else #define _EXTERN #endif #define _DLLEXPORT _EXTERN __declspec(dllexport) #define FUN(__NAME__, __RV__, __PARAMS__) _DLLEXPORT __RV__ __NAME__ __PARAMS__; #define EXPORT(__NAME__, __RV__, __PARAMS__, __PNAMES__) \ _EXTERN __RV__ __NAME__ __PARAMS__; \ _DLLEXPORT __RV__ UNDERSCORE(__NAME__) __PARAMS__ { return __NAME__ __PNAMES__; } #define BEGIN_DFUNCTIONS(__LIBNAME__) #define END_DFUNCTIONS #define D_ENUM(__NAME__) enum #endif #endif