api.h (2289B)
1/** 2 * FreeRDP: A Remote Desktop Protocol Implementation 3 * FreeRDP Interface 4 * 5 * Copyright 2009-2011 Jay Sorg 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20#ifndef FREERDP_API_H 21#define FREERDP_API_H 22 23#include <winpr/winpr.h> 24#include <winpr/platform.h> 25 26#ifdef _WIN32 27#define FREERDP_CC __cdecl 28#else 29#define FREERDP_CC 30#endif 31 32#ifdef _WIN32 33#define __func__ __FUNCTION__ 34#endif 35 36#if defined _WIN32 || defined __CYGWIN__ 37#ifdef FREERDP_EXPORTS 38#ifdef __GNUC__ 39#define FREERDP_API __attribute__((dllexport)) 40#else 41#define FREERDP_API __declspec(dllexport) 42#endif 43#else 44#ifdef __GNUC__ 45#define FREERDP_API __attribute__((dllimport)) 46#else 47#define FREERDP_API __declspec(dllimport) 48#endif 49#endif 50#else 51#if __GNUC__ >= 4 52#define FREERDP_API __attribute__((visibility("default"))) 53#else 54#define FREERDP_API 55#endif 56#endif 57 58#ifdef BUILD_TESTING 59#define FREERDP_LOCAL FREERDP_API 60#else 61#if defined _WIN32 || defined __CYGWIN__ 62#define FREERDP_LOCAL 63#else 64#if __GNUC__ >= 4 65#define FREERDP_LOCAL __attribute__((visibility("hidden"))) 66#else 67#define FREERDP_LOCAL 68#endif 69#endif 70#endif 71 72#ifdef FREERDP_TEST_EXPORTS 73#define FREERDP_TEST_API FREERDP_API 74#else 75#define FREERDP_TEST_API 76#endif 77 78#define IFCALL(_cb, ...) \ 79 do \ 80 { \ 81 if (_cb != NULL) \ 82 { \ 83 _cb(__VA_ARGS__); \ 84 } \ 85 } while (0) 86#define IFCALLRET(_cb, _ret, ...) \ 87 do \ 88 { \ 89 if (_cb != NULL) \ 90 { \ 91 _ret = _cb(__VA_ARGS__); \ 92 } \ 93 } while (0) 94#define IFCALLRESULT(_default_return, _cb, ...) \ 95 ((_cb != NULL) ? _cb(__VA_ARGS__) : (_default_return)) 96 97#endif /* FREERDP_API */