--- src/bdftogd.orig 2021-09-11 04:41:44 UTC +++ src/bdftogd @@ -24,6 +24,9 @@ $gdname = 'gd' . $gdname unless $gdname =~ /^gd/i; my $filename = shift; $filename = 'gd' . $filename unless $filename =~ /^gd/i; +my $gdfunc = $gdname; +$gdfunc =~ s/(.*Font)(.*)/$1Get$2/; + if (-f "$filename.c") { die "File $filename.c already exists, won't overwrite\n"; } if (-f "$filename.h") { die "File $filename.h already exists, won't overwrite\n"; } @@ -139,6 +142,10 @@ print FILEC <<"EOF"; $info +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "$filename.h" char ${gdname}Data[] = { @@ -177,28 +184,40 @@ gdFont ${gdname}Rep = { ${gdname}Data }; -gdFontPtr ${gdname} = &${gdname}Rep; +BGD_EXPORT_DATA_PROT gdFontPtr ${gdname} = &${gdname}Rep; -/* This file has not been truncated. */ +BGD_DECLARE(gdFontPtr) +$gdfunc (void) +{ + return $gdname; +} +/* This file has not been truncated. */ EOF close FILEC; print FILEH <<"EOF"; - #ifndef $capdef #define $capdef 1 +#ifdef __cplusplus +extern "C" { +#endif + $info #include "gd.h" -extern gdFontPtr $gdname; +extern BGD_EXPORT_DATA_PROT gdFontPtr $gdname; +BGD_DECLARE(gdFontPtr) $gdfunc(void); +#ifdef __cplusplus +} #endif +#endif EOF 1;