From 682fc664ee45afb274c9c458c0386b897c881a4b Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Mon, 24 Jan 2000 14:14:20 +0000 Subject: [PATCH] force linkage of the function wrappers for globals in change#4878 p4raw-link: @4878 on //depot/perl: 6f4183fe04888927cb36b966262c959c5166404b p4raw-id: //depot/perl@4879 --- embed.pl | 41 +++++++++++++++++++++++++++++++++++++++-- globals.c | 2 ++ perlapi.h | 41 +++++++++++++++++++++++++++++++++++++++-- win32/win32.h | 1 + 4 files changed, 81 insertions(+), 4 deletions(-) diff --git a/embed.pl b/embed.pl index c1ea2e6..5305dad 100755 --- a/embed.pl +++ b/embed.pl @@ -800,9 +800,46 @@ START_EXTERN_C END_EXTERN_C -#if !defined(PERL_CORE) +#if defined(PERL_CORE) -/* accessor functions for Perl variables (provides binary compatibility) */ +/* accessor functions for Perl variables (provide binary compatibility) */ + +/* these need to be mentioned here, or most linkers won't put them in + the perl executable */ + +#ifndef PERL_NO_FORCE_LINK + +START_EXTERN_C + +#ifndef DOINIT +EXT void *PL_force_link_funcs[]; +#else +EXT void *PL_force_link_funcs[] = { +#undef PERLVAR +#undef PERLVARA +#undef PERLVARI +#undef PERLVARIC +#define PERLVAR(v,t) Perl_##v##_ptr, +#define PERLVARA(v,n,t) PERLVAR(v,t) +#define PERLVARI(v,t,i) PERLVAR(v,t) +#define PERLVARIC(v,t,i) PERLVAR(v,t) + +#include "thrdvar.h" +#include "intrpvar.h" +#include "perlvars.h" + +#undef PERLVAR +#undef PERLVARA +#undef PERLVARI +#undef PERLVARIC +}; +#endif /* DOINIT */ + +START_EXTERN_C + +#endif /* PERL_NO_FORCE_LINK */ + +#else /* !PERL_CORE */ EOT diff --git a/globals.c b/globals.c index 41dc924..0782eba 100644 --- a/globals.c +++ b/globals.c @@ -78,3 +78,5 @@ Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...) va_start(arglist, format); return PerlIO_vprintf(stream, format, arglist); } + +#include "perlapi.h" /* bring in PL_force_link_funcs */ diff --git a/perlapi.h b/perlapi.h index 0c92f99..769d4ca 100644 --- a/perlapi.h +++ b/perlapi.h @@ -39,9 +39,46 @@ START_EXTERN_C END_EXTERN_C -#if !defined(PERL_CORE) +#if defined(PERL_CORE) -/* accessor functions for Perl variables (provides binary compatibility) */ +/* accessor functions for Perl variables (provide binary compatibility) */ + +/* these need to be mentioned here, or most linkers won't put them in + the perl executable */ + +#ifndef PERL_NO_FORCE_LINK + +START_EXTERN_C + +#ifndef DOINIT +EXT void *PL_force_link_funcs[]; +#else +EXT void *PL_force_link_funcs[] = { +#undef PERLVAR +#undef PERLVARA +#undef PERLVARI +#undef PERLVARIC +#define PERLVAR(v,t) Perl_##v##_ptr, +#define PERLVARA(v,n,t) PERLVAR(v,t) +#define PERLVARI(v,t,i) PERLVAR(v,t) +#define PERLVARIC(v,t,i) PERLVAR(v,t) + +#include "thrdvar.h" +#include "intrpvar.h" +#include "perlvars.h" + +#undef PERLVAR +#undef PERLVARA +#undef PERLVARI +#undef PERLVARIC +}; +#endif /* DOINIT */ + +START_EXTERN_C + +#endif /* PERL_NO_FORCE_LINK */ + +#else /* !PERL_CORE */ #undef PL_Argv #define PL_Argv (*Perl_IArgv_ptr(aTHXo)) diff --git a/win32/win32.h b/win32/win32.h index 9d56578..d447f2b 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -123,6 +123,7 @@ struct utsname { #define PERL_SOCK_SYSREAD_IS_RECV #define PERL_SOCK_SYSWRITE_IS_SEND +#define PERL_NO_FORCE_LINK /* no need for PL_force_link_funcs */ /* if USE_WIN32_RTL_ENV is not defined, Perl uses direct Win32 calls * to read the environment, bypassing the runtime's (usually broken) -- 2.7.4