Removing FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT. It has never worked.

Instead, define BASE_DEF() and BASE_FUNC() similarly to FT_EXPORT_DEF() and
FT_EXPORT_FUNC(), respectively, allowing the programmer to define proper
types and/or export lists for multiple DLLs if necessary (e.g. ftbase.dll --
standalone, fttype1.dll -- needs ftbase.dll, etc.).

The library is finally compiling and linking natively with a C++ compiler!
This commit is contained in:
Werner Lemberg 2000-08-01 17:05:20 +00:00
parent c713d924d8
commit 3a89c2a4ac
13 changed files with 81 additions and 32 deletions

View File

@ -159,33 +159,78 @@
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define LOCAL_DEF static
#define LOCAL_FUNC static #define LOCAL_DEF static
#define LOCAL_FUNC static
#else #else
#define LOCAL_DEF extern
#define LOCAL_FUNC /* nothing */
#endif
#ifdef FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT #ifdef __cplusplus
#define BASE_DEF( x ) static x #define LOCAL_DEF extern "C"
#define BASE_FUNC( x ) static x #define LOCAL_FUNC extern "C"
#else #else
#define BASE_DEF( x ) extern x #define LOCAL_DEF extern
#define BASE_FUNC( x ) extern x #define LOCAL_FUNC extern
#endif #endif
#ifndef FT_EXPORT_DEF #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
#define FT_EXPORT_DEF( x ) extern x
#ifndef BASE_DEF
#ifdef __cplusplus
#define BASE_DEF( x ) extern "C" x
#else
#define BASE_DEF( x ) extern x
#endif #endif
#ifndef FT_EXPORT_FUNC #endif /* !BASE_DEF */
#define FT_EXPORT_FUNC( x ) extern x
#ifndef BASE_FUNC
#ifdef __cplusplus
#define BASE_FUNC( x ) extern "C" x
#else
#define BASE_FUNC( x ) extern x
#endif #endif
#ifndef FT_EXPORT_VAR #endif /* !BASE_FUNC */
#define FT_EXPORT_VAR( x ) extern x
#ifndef FT_EXPORT_DEF
#ifdef __cplusplus
#define FT_EXPORT_DEF( x ) extern "C" x
#else
#define FT_EXPORT_DEF( x ) extern x
#endif #endif
#endif /* !FT_EXPORT_DEF */
#ifndef FT_EXPORT_FUNC
#ifdef __cplusplus
#define FT_EXPORT_FUNC( x ) extern "C" x
#else
#define FT_EXPORT_FUNC( x ) extern x
#endif
#endif /* !FT_EXPORT_FUNC */
#ifndef FT_EXPORT_VAR
#ifdef __cplusplus
#define FT_EXPORT_VAR( x ) extern "C" x
#else
#define FT_EXPORT_VAR( x ) extern x
#endif
#endif /* !FT_EXPORT_VAR */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -107,7 +107,7 @@
}; };
const FT_Module_Class autohint_module_class = FT_EXPORT_VAR( const FT_Module_Class ) autohint_module_class =
{ {
ft_module_hinter, ft_module_hinter,
sizeof ( FT_AutoHinterRec ), sizeof ( FT_AutoHinterRec ),

View File

@ -53,7 +53,11 @@
#define FT_COMPONENT trace_init #define FT_COMPONENT trace_init
#undef FT_USE_MODULE #undef FT_USE_MODULE
#ifdef __cplusplus
#define FT_USE_MODULE( x ) extern "C" const FT_Module_Class* x;
#else
#define FT_USE_MODULE( x ) extern const FT_Module_Class* x; #define FT_USE_MODULE( x ) extern const FT_Module_Class* x;
#endif
#include <freetype/config/ftmodule.h> #include <freetype/config/ftmodule.h>

View File

@ -302,7 +302,7 @@
/* The FT_DriverInterface structure is defined in ftdriver.h. */ /* The FT_DriverInterface structure is defined in ftdriver.h. */
const FT_Driver_Class cff_driver_class = FT_EXPORT_VAR( const FT_Driver_Class ) cff_driver_class =
{ {
/* begin with the FT_Module_Class fields */ /* begin with the FT_Module_Class fields */
{ {

View File

@ -182,7 +182,7 @@
} }
const FT_Driver_Class t1cid_driver_class = FT_EXPORT_VAR( const FT_Driver_Class ) t1cid_driver_class =
{ {
/* first of all, the FT_Module_Class fields */ /* first of all, the FT_Module_Class fields */
{ {

View File

@ -296,7 +296,7 @@
#endif /* !FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES */ #endif /* !FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES */
const FT_Module_Class psnames_module_class = FT_EXPORT_VAR( const FT_Module_Class ) psnames_module_class =
{ {
0, /* this is not a font driver, nor a renderer */ 0, /* this is not a font driver, nor a renderer */
sizeof( FT_ModuleRec ), sizeof( FT_ModuleRec ),

View File

@ -213,7 +213,7 @@
} }
const FT_Renderer_Class ft_raster1_renderer_class = FT_EXPORT_VAR( const FT_Renderer_Class ) ft_raster1_renderer_class =
{ {
{ {
ft_module_renderer, ft_module_renderer,
@ -241,10 +241,11 @@
}; };
/* this renderer is _NOT_ part of the default modules, you'll need */ /* This renderer is _NOT_ part of the default modules; you will need */
/* to register it by hand in your application. It should only be */ /* to register it by hand in your application. It should only be */
/* used for backwards-compatibility with FT 1.x anyway. */ /* used for backwards-compatibility with FT 1.x anyway. */
const FT_Renderer_Class ft_raster5_renderer_class = /* */
FT_EXPORT_VAR( const FT_Renderer_Class ) ft_raster5_renderer_class =
{ {
{ {
ft_module_renderer, ft_module_renderer,

View File

@ -204,8 +204,7 @@
}; };
const FT_EXPORT_VAR( const FT_Module_Class ) sfnt_module_class =
FT_Module_Class sfnt_module_class =
{ {
0, /* not a font driver or renderer */ 0, /* not a font driver or renderer */
sizeof( FT_ModuleRec ), sizeof( FT_ModuleRec ),

View File

@ -189,7 +189,7 @@
} }
const FT_Renderer_Class ft_smooth_renderer_class = FT_EXPORT_VAR( const FT_Renderer_Class ) ft_smooth_renderer_class =
{ {
{ {
ft_module_renderer, ft_module_renderer,

View File

@ -430,7 +430,7 @@
/* The FT_DriverInterface structure is defined in ftdriver.h. */ /* The FT_DriverInterface structure is defined in ftdriver.h. */
const FT_Driver_Class tt_driver_class = FT_EXPORT_VAR( const FT_Driver_Class ) tt_driver_class =
{ {
{ {
ft_module_font_driver | ft_module_font_driver |

View File

@ -324,7 +324,7 @@
const FT_Driver_Class t1_driver_class = FT_EXPORT_VAR( const FT_Driver_Class ) t1_driver_class =
{ {
{ {
ft_module_font_driver | ft_module_driver_scalable, ft_module_font_driver | ft_module_driver_scalable,

View File

@ -283,7 +283,7 @@
} }
const FT_Driver_Class t1_driver_class = FT_EXPORT_VAR( const FT_Driver_Class ) t1_driver_class =
{ {
{ {
ft_module_font_driver | ft_module_driver_scalable, ft_module_font_driver | ft_module_driver_scalable,

View File

@ -588,7 +588,7 @@
} }
const FT_Driver_Class winfnt_driver_class = FT_EXPORT_VAR( const FT_Driver_Class ) winfnt_driver_class =
{ {
{ {
ft_module_font_driver, ft_module_font_driver,