2020-07-02 11:09:57 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* config/public-macros.h
|
|
|
|
*
|
|
|
|
* Define a set of compiler macros used in public FreeType headers.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 by
|
|
|
|
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
|
|
*
|
|
|
|
* This file is part of the FreeType project, and may only be used,
|
|
|
|
* modified, and distributed under the terms of the FreeType project
|
|
|
|
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
|
|
|
* this file you indicate that you have read the license and
|
|
|
|
* understand and accept it fully.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* The definitions in this file are used by the public FreeType headers,
|
|
|
|
* and thus should be considered part of the public API.
|
|
|
|
*
|
|
|
|
* Other compiler-specific macro definitions that are not exposed by the
|
|
|
|
* FreeType API should go into include/freetype/internal/compiler-macros.h
|
|
|
|
* instead.
|
|
|
|
*/
|
|
|
|
#ifndef FREETYPE_CONFIG_PUBLIC_MACROS_H_
|
|
|
|
#define FREETYPE_CONFIG_PUBLIC_MACROS_H_
|
|
|
|
|
|
|
|
/* FT_BEGIN_HEADER and FT_END_HEADER might have already been defined by
|
|
|
|
* <freetype/config/ftheader.h>, but we don't want to include this header
|
|
|
|
* here, so redefine the macros here only when needed. Their definition is
|
|
|
|
* very stable, so keeping them in sync with the ones in the header should
|
|
|
|
* not be a maintenance issue.
|
|
|
|
*/
|
|
|
|
#ifndef FT_BEGIN_HEADER
|
|
|
|
# ifdef __cplusplus
|
|
|
|
# define FT_BEGIN_HEADER extern "C" {
|
|
|
|
# else
|
|
|
|
# define FT_BEGIN_HEADER /* nothing */
|
|
|
|
# endif
|
|
|
|
#endif /* FT_END_HEADER */
|
|
|
|
|
|
|
|
#ifndef FT_END_HEADER
|
|
|
|
# ifdef __cplusplus
|
|
|
|
# define FT_END_HEADER }
|
|
|
|
# else
|
|
|
|
# define FT_END_HEADER /* nothing */
|
|
|
|
# endif
|
|
|
|
#endif /* FT_END_HEADER */
|
|
|
|
|
|
|
|
FT_BEGIN_HEADER
|
|
|
|
|
[build] Improve visibility support of library function names.
* include/freetype/config/public-macros.h
(FT_PUBLIC_FUNCTION_ATTRIBUTE): New macro to tag functions as
public (and thus exportable).
(FT_EXPORT): Use it.
* include/freetype/config/compiler-macros.h
(FT_INTERNAL_FUNCTION_ATTRIBUTE): New macro to tag functions as
internal to the library (and thus hidden). Note that on ELF
systems, all internal functions have hidden visibility, which avoids
the need to enforce this when invoking the compiler (e.g., with an
option like `-fvisibility=hidden').
(FT_FUNCTION_DECLARATION, FT_FUNCTION_DEFINITION): New base macros
to deal with C and C++ linkage issues at the same time.
(FT_LOCAL, FT_LOCAL_DEF, FT_LOCAL_ARRAY, FT_LOCAL_ARRAY_DEF,
FT_BASE, FT_BASE_DEF, FT_EXPORT_VAR, FT_BASE_CALLBACK,
FT_BASE_CALLBACK_DEF): Redefined using new macros.
2020-07-02 11:20:10 +02:00
|
|
|
/* Mark a function declaration as public. This ensures it will be properly
|
|
|
|
* exported to client code. Place this before a function declaration.
|
|
|
|
*
|
|
|
|
* NOTE: This macro should be considered an internal implementation detail, and
|
|
|
|
* not part of the FreeType API. It is only defined here because it is needed
|
|
|
|
* by FT_EXPORT()
|
2020-07-02 11:09:57 +02:00
|
|
|
*/
|
[build] Improve visibility support of library function names.
* include/freetype/config/public-macros.h
(FT_PUBLIC_FUNCTION_ATTRIBUTE): New macro to tag functions as
public (and thus exportable).
(FT_EXPORT): Use it.
* include/freetype/config/compiler-macros.h
(FT_INTERNAL_FUNCTION_ATTRIBUTE): New macro to tag functions as
internal to the library (and thus hidden). Note that on ELF
systems, all internal functions have hidden visibility, which avoids
the need to enforce this when invoking the compiler (e.g., with an
option like `-fvisibility=hidden').
(FT_FUNCTION_DECLARATION, FT_FUNCTION_DEFINITION): New base macros
to deal with C and C++ linkage issues at the same time.
(FT_LOCAL, FT_LOCAL_DEF, FT_LOCAL_ARRAY, FT_LOCAL_ARRAY_DEF,
FT_BASE, FT_BASE_DEF, FT_EXPORT_VAR, FT_BASE_CALLBACK,
FT_BASE_CALLBACK_DEF): Redefined using new macros.
2020-07-02 11:20:10 +02:00
|
|
|
#if defined(_WIN32)
|
|
|
|
# if defined(FT2_BUILD_LIBRARY) && defined( DLL_EXPORT )
|
|
|
|
# define FT_PUBLIC_FUNCTION_ATTRIBUTE __declspec( dllexport )
|
|
|
|
# elif defined( DLL_IMPORT )
|
|
|
|
# define FT_PUBLIC_FUNCTION_ATTRIBUTE __declspec( dllimport )
|
|
|
|
# endif
|
|
|
|
#elif (defined(__GNUC__) && __GNUC__ >= 4) || defined(__clang__)
|
|
|
|
# define FT_PUBLIC_FUNCTION_ATTRIBUTE __attribute__((visibility("default")))
|
|
|
|
#elif defined(__SUNPRO_C) && __SUNPRO_C >= 0x550
|
|
|
|
# define FT_PUBLIC_FUNCTION_ATTRIBUTE __global
|
2020-07-02 11:09:57 +02:00
|
|
|
#endif
|
|
|
|
|
[build] Improve visibility support of library function names.
* include/freetype/config/public-macros.h
(FT_PUBLIC_FUNCTION_ATTRIBUTE): New macro to tag functions as
public (and thus exportable).
(FT_EXPORT): Use it.
* include/freetype/config/compiler-macros.h
(FT_INTERNAL_FUNCTION_ATTRIBUTE): New macro to tag functions as
internal to the library (and thus hidden). Note that on ELF
systems, all internal functions have hidden visibility, which avoids
the need to enforce this when invoking the compiler (e.g., with an
option like `-fvisibility=hidden').
(FT_FUNCTION_DECLARATION, FT_FUNCTION_DEFINITION): New base macros
to deal with C and C++ linkage issues at the same time.
(FT_LOCAL, FT_LOCAL_DEF, FT_LOCAL_ARRAY, FT_LOCAL_ARRAY_DEF,
FT_BASE, FT_BASE_DEF, FT_EXPORT_VAR, FT_BASE_CALLBACK,
FT_BASE_CALLBACK_DEF): Redefined using new macros.
2020-07-02 11:20:10 +02:00
|
|
|
#ifndef FT_PUBLIC_FUNCTION_ATTRIBUTE
|
|
|
|
# define FT_PUBLIC_FUNCTION_ATTRIBUTE /* nothing */
|
|
|
|
#endif
|
2020-07-02 11:09:57 +02:00
|
|
|
|
[build] Improve visibility support of library function names.
* include/freetype/config/public-macros.h
(FT_PUBLIC_FUNCTION_ATTRIBUTE): New macro to tag functions as
public (and thus exportable).
(FT_EXPORT): Use it.
* include/freetype/config/compiler-macros.h
(FT_INTERNAL_FUNCTION_ATTRIBUTE): New macro to tag functions as
internal to the library (and thus hidden). Note that on ELF
systems, all internal functions have hidden visibility, which avoids
the need to enforce this when invoking the compiler (e.g., with an
option like `-fvisibility=hidden').
(FT_FUNCTION_DECLARATION, FT_FUNCTION_DEFINITION): New base macros
to deal with C and C++ linkage issues at the same time.
(FT_LOCAL, FT_LOCAL_DEF, FT_LOCAL_ARRAY, FT_LOCAL_ARRAY_DEF,
FT_BASE, FT_BASE_DEF, FT_EXPORT_VAR, FT_BASE_CALLBACK,
FT_BASE_CALLBACK_DEF): Redefined using new macros.
2020-07-02 11:20:10 +02:00
|
|
|
/* Define a public FreeType API function. This ensures it is properly exported
|
|
|
|
* or imported at build time. The macro parameter is the function's return type
|
|
|
|
* as in:
|
|
|
|
*
|
|
|
|
* FT_EXPORT( FT_Bool ) FT_Object_Method( FT_Object obj, ... );
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define FT_EXPORT( x ) FT_PUBLIC_FUNCTION_ATTRIBUTE extern "C" x
|
2020-07-02 11:09:57 +02:00
|
|
|
#else
|
[build] Improve visibility support of library function names.
* include/freetype/config/public-macros.h
(FT_PUBLIC_FUNCTION_ATTRIBUTE): New macro to tag functions as
public (and thus exportable).
(FT_EXPORT): Use it.
* include/freetype/config/compiler-macros.h
(FT_INTERNAL_FUNCTION_ATTRIBUTE): New macro to tag functions as
internal to the library (and thus hidden). Note that on ELF
systems, all internal functions have hidden visibility, which avoids
the need to enforce this when invoking the compiler (e.g., with an
option like `-fvisibility=hidden').
(FT_FUNCTION_DECLARATION, FT_FUNCTION_DEFINITION): New base macros
to deal with C and C++ linkage issues at the same time.
(FT_LOCAL, FT_LOCAL_DEF, FT_LOCAL_ARRAY, FT_LOCAL_ARRAY_DEF,
FT_BASE, FT_BASE_DEF, FT_EXPORT_VAR, FT_BASE_CALLBACK,
FT_BASE_CALLBACK_DEF): Redefined using new macros.
2020-07-02 11:20:10 +02:00
|
|
|
#define FT_EXPORT( x ) FT_PUBLIC_FUNCTION_ATTRIBUTE extern x
|
2020-07-02 11:09:57 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
FT_END_HEADER
|
|
|
|
|
|
|
|
#endif /* FREETYPE_CONFIG_PUBLIC_MACROS_H_ */
|