2 * Copyright (C) 2005,2006,2007 MaNGOS <http://www.mangosproject.org/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef MANGOS_DEFINE_H
20 #define MANGOS_DEFINE_H
22 #include "Platform/CompilerDefs.h"
23 #include <sys/types.h>
26 #define MANGOS_EXPORT __declspec(dllexport)
27 #define MANGOS_LIBRARY_HANDLE HMODULE
28 #define MANGOS_LOAD_LIBRARY(a) LoadLibrary(a)
29 #define MANGOS_CLOSE_LIBRARY FreeLibrary
30 #define MANGOS_GET_PROC_ADDR GetProcAddress
31 #define MANGOS_IMPORT __cdecl
32 #define MANGOS_SCRIPT_EXT ".dll"
33 #define MANGOS_SCRIPT_NAME "MaNGOSScript"
36 #define MANGOS_LIBRARY_HANDLE void*
37 #define MANGOS_EXPORT export
38 #define MANGOS_LOAD_LIBRARY(a) dlopen(a,RTLD_NOW)
39 #define MANGOS_CLOSE_LIBRARY dlclose
40 #define MANGOS_GET_PROC_ADDR dlsym
42 #if defined(__APPLE_CC__) && defined(BIG_ENDIAN)
43 #define MANGOS_IMPORT __attribute__ ((longcall))
45 #define MANGOS_IMPORT __attribute__ ((cdecl))
48 #define MANGOS_SCRIPT_EXT ".so"
49 #define MANGOS_SCRIPT_NAME "libmangosscript"
53 #ifdef MANGOS_WIN32_DLL_IMPORT
55 #define MANGOS_DLL_DECL __declspec(dllimport)
57 #ifdef MANGOS_WIND_DLL_EXPORT
58 #define MANGOS_DLL_DECL __declspec(dllexport)
60 #define MANGOS_DLL_DECL
65 #define MANGOS_DLL_DECL
69 #define MANGOS_INLINE inline
77 #if COMPILER == COMPILER_MICROSOFT
78 typedef __int64 int64
;
82 typedef unsigned __int64 uint64
;
83 typedef unsigned long uint32
;
84 typedef unsigned short uint16
;
85 typedef unsigned char uint8
;
87 //typedef long long int64;
88 typedef __int64_t int64
;
89 typedef __int32_t int32
;
90 typedef __int16_t int16
;
91 typedef __int8_t int8
;
92 typedef __uint64_t uint64
;
93 typedef __uint32_t uint32
;
94 typedef __uint16_t uint16
;
95 typedef __uint8_t uint8
;
99 typedef uint64 OBJECT_HANDLE
;
101 #if PLATFORM == PLATFORM_WIN32
102 # ifndef DECLSPEC_NORETURN
103 # define DECLSPEC_NORETURN __declspec(noreturn)
106 # define DECLSPEC_NORETURN
109 #if COMPILER == COMPILER_GNU
110 # define ATTR_NORETURN __attribute__((noreturn))
111 # define ATTR_PRINTF(F,V) __attribute__ ((format (printf, F, V)))
113 # define ATTR_NORETURN
114 # define ATTR_PRINTF(F,V)