This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
e3cf8da53af64bf712813e16ec85dd781513f956
[perl5.git] / makedef.pl
1 #./perl -w
2 #
3 # Create the export list for perl.
4 #
5 # Needed by WIN32 and OS/2 for creating perl.dll,
6 # and by AIX for creating libperl.a when -Dusershrplib is in effect,
7 # and by VMS for creating perlshr.exe.
8 #
9 # Reads from information stored in
10 #
11 #    config.h
12 #    config.sh
13 #    global.sym
14 #    globvar.sym
15 #    intrpvar.h
16 #    miniperl.map (on OS/2)
17 #    perl5.def    (on OS/2; this is the old version of the file being made)
18 #    perlio.sym
19 #    perlvars.h
20 #
21 # plus long lists of function names hard-coded directly in this script and
22 # in the DATA section.
23 #
24 # Writes the result to STDOUT.
25 #
26 # Normally this script is invoked from a makefile (e.g. win32/Makefile),
27 # which redirects STDOUT to a suitable file, such as:
28 #
29 #    perl5.def   OS/2
30 #    perldll.def Windows
31 #    perl.exp    AIX
32 #    perl.imp    NetWare
33 #    makedef.lis VMS
34
35 BEGIN { unshift @INC, "lib" }
36 use Config;
37 use strict;
38
39 use vars qw($PLATFORM $CCTYPE $FILETYPE $TARG_DIR);
40
41 $CCTYPE = 'MSVC';
42 $TARG_DIR = '';
43
44 my (%define, %ordinal);
45
46 while (@ARGV) {
47     my $flag = shift;
48     if ($flag =~ s/^CC_FLAGS=/ /) {
49         for my $fflag ($flag =~ /(?:^|\s)-D(\S+)/g) {
50             $fflag     .= '=1' unless $fflag =~ /^(\w+)=/;
51             $define{$1} = $2   if $fflag =~ /^(\w+)=(.+)$/;
52         }
53         next;
54     }
55     $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
56     $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/);
57     $CCTYPE   = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
58     $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
59     $FILETYPE = $1 if ($flag =~ /^FILETYPE=(\w+)$/);
60     $TARG_DIR = $1 if $flag =~ /^TARG_DIR=(.+)$/;
61 }
62
63 my @PLATFORM = qw(aix win32 wince os2 netware vms);
64 my %PLATFORM;
65 @PLATFORM{@PLATFORM} = ();
66
67 defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
68 exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
69
70 if ($PLATFORM eq 'win32' or $PLATFORM eq 'wince' or $PLATFORM eq "aix") {
71         # Add the compile-time options that miniperl was built with to %define.
72         # On Win32 these are not the same options as perl itself will be built
73         # with since miniperl is built with a canned config (one of the win32/
74         # config_H.*) and none of the BUILDOPT's that are set in the makefiles,
75         # but they do include some #define's that are hard-coded in various
76         # source files and header files and don't include any BUILDOPT's that
77         # the user might have chosen to disable because the canned configs are
78         # minimal configs that don't include any of those options.
79
80         my @options
81             = sort(Config::bincompat_options(), Config::non_bincompat_options());
82         print STDERR "Options: (@options)\n";
83         $define{$_} = 1 foreach @options;
84 }
85
86 my %exportperlmalloc =
87     (
88        Perl_malloc              =>      "malloc",
89        Perl_mfree               =>      "free",
90        Perl_realloc             =>      "realloc",
91        Perl_calloc              =>      "calloc",
92     );
93
94 my $exportperlmalloc = $PLATFORM eq 'os2';
95
96 my $config_sh   = "config.sh";
97 my $config_h    = "config.h";
98 my $intrpvar_h  = "intrpvar.h";
99 my $perlvars_h  = "perlvars.h";
100 my $global_sym  = "global.sym";
101 my $globvar_sym = "globvar.sym";
102 my $perlio_sym  = "perlio.sym";
103 my $static_ext = "";
104
105 my %skip;
106 # All platforms export boot_DynaLoader unconditionally.
107 my %export = ( boot_DynaLoader => 1 );
108
109 s/^/$TARG_DIR/ foreach($intrpvar_h, $perlvars_h, $global_sym, $globvar_sym,
110                        $perlio_sym, $config_sh);
111
112 unless ($PLATFORM eq 'win32' || $PLATFORM eq 'wince' || $PLATFORM eq 'netware') {
113     open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n";
114     while (<CFG>) {
115         if (/^(?:ccflags|optimize)='(.+)'$/) {
116             $_ = $1;
117             $define{$1} = 1 while /-D(\w+)/g;
118         }
119         $define{$1} = $2
120             if /^(config_args|archname|perl_patchlevel)='(.+)'$/;
121         if ($PLATFORM eq 'vms') {
122             $define{DEBUGGING} = 1 if /^usedebugging_perl='Y'$/;
123             $define{UNLINK_ALL_VERSIONS} = 1 if /^d_unlink_all_versions='define'$/;
124         }
125     }
126     close(CFG);
127 }
128 if ($PLATFORM eq 'win32' || $PLATFORM eq 'wince') {
129     open(CFG, '<', $config_sh) || die "Cannot open $config_sh: $!\n";
130     if ((join '', <CFG>) =~ /^static_ext='(.*)'$/m) {
131         $static_ext = $1;
132     }
133     close(CFG);
134 }
135
136 open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
137 while (<CFG>) {
138     $define{$1} = 1 if /^\s*\#\s*define\s+(MYMALLOC|MULTIPLICITY
139                                            |SPRINTF_RETURNS_STRLEN
140                                            |(?:PERL|USE|HAS)_\w+)\b/x;
141 }
142 close(CFG);
143
144 # perl.h logic duplication begins
145
146 if ($define{PERL_IMPLICIT_SYS}) {
147     $define{PL_OP_SLAB_ALLOC} = 1;
148 }
149
150 if ($define{USE_ITHREADS}) {
151     if (!$define{MULTIPLICITY}) {
152         $define{MULTIPLICITY} = 1;
153     }
154 }
155
156 $define{PERL_IMPLICIT_CONTEXT} ||=
157     $define{USE_ITHREADS} ||
158     $define{MULTIPLICITY} ;
159
160 if ($define{USE_ITHREADS} && $PLATFORM ne 'win32' && $^O ne 'darwin') {
161     $define{USE_REENTRANT_API} = 1;
162 }
163
164 # perl.h logic duplication ends
165
166 my $sym_ord = 0;
167
168 print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n";
169
170 if ($PLATFORM =~ /^win(?:32|ce)$/) {
171     (my $dll = ($define{PERL_DLL} || "perl515")) =~ s/\.dll$//i;
172     print "LIBRARY $dll\n";
173     # The DESCRIPTION module definition file statement is not supported
174     # by VC7 onwards.
175     if ($CCTYPE =~ /^(?:MSVC60|GCC|BORLAND)$/) {
176         print "DESCRIPTION 'Perl interpreter'\n";
177     }
178     print "EXPORTS\n";
179     if ($define{PERL_IMPLICIT_SYS}) {
180         ++$export{$_} foreach qw(perl_get_host_info perl_alloc_override);
181     }
182     if ($define{USE_ITHREADS} and $define{PERL_IMPLICIT_SYS}) {
183         ++$export{perl_clone_host};
184     }
185 }
186 elsif ($PLATFORM eq 'os2') {
187     if (open my $fh, '<', 'perl5.def') {
188       while (<$fh>) {
189         last if /^\s*EXPORTS\b/;
190       }
191       while (<$fh>) {
192         $ordinal{$1} = $2 if /^\s*"(\w+)"\s*(?:=\s*"\w+"\s*)?\@(\d+)\s*$/;
193         # This allows skipping ordinals which were used in older versions
194         $sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/;
195       }
196       $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max
197     }
198     (my $v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
199     $v .= '-thread' if $define{archname} =~ /-thread/;
200     (my $dll = $define{PERL_DLL}) =~ s/\.dll$//i;
201     $v .= "\@$define{perl_patchlevel}" if $define{perl_patchlevel};
202     my $d = "DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $define{config_args}'";
203     $d = substr($d, 0, 249) . "...'" if length $d > 253;
204     print <<"---EOP---";
205 LIBRARY '$dll' INITINSTANCE TERMINSTANCE
206 $d
207 STACKSIZE 32768
208 CODE LOADONCALL
209 DATA LOADONCALL NONSHARED MULTIPLE
210 EXPORTS
211 ---EOP---
212 }
213 elsif ($PLATFORM eq 'aix') {
214     my $OSVER = `uname -v`;
215     chop $OSVER;
216     my $OSREL = `uname -r`;
217     chop $OSREL;
218     if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) {
219         print "#! ..\n";
220     } else {
221         print "#!\n";
222     }
223 }
224 elsif ($PLATFORM eq 'netware') {
225         if ($FILETYPE eq 'def') {
226         print "LIBRARY perl515\n";
227         print "DESCRIPTION 'Perl interpreter for NetWare'\n";
228         print "EXPORTS\n";
229         }
230         if ($define{PERL_IMPLICIT_SYS}) {
231             ++$export{$_}
232                 foreach qw(perl_get_host_info perl_alloc_override perl_clone_host);
233         }
234 }
235
236 sub skip_symbols {
237     my $list = shift;
238     foreach my $symbol (@$list) {
239         $skip{$symbol} = 1;
240     }
241 }
242
243 sub emit_symbols {
244     my $list = shift;
245     foreach my $symbol (@$list) {
246         my $skipsym = $symbol;
247         # XXX hack
248         if ($define{MULTIPLICITY}) {
249             $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
250         }
251         emit_symbol($symbol) unless exists $skip{$skipsym};
252     }
253 }
254
255 if ($PLATFORM ne 'os2') {
256     skip_symbols [qw(
257                      PL_cryptseen
258                      PL_opsave
259                      Perl_GetVars
260                      Perl_dump_fds
261                      Perl_my_bcopy
262                      Perl_my_bzero
263                      Perl_my_chsize
264                      Perl_my_htonl
265                      Perl_my_memcmp
266                      Perl_my_memset
267                      Perl_my_ntohl
268                      Perl_my_swap
269                    )];
270     if ($PLATFORM eq 'vms') {
271         skip_symbols([qw(
272                             PL_statusvalue_posix
273                      )]);
274     } else {
275         skip_symbols([qw(
276                             PL_statusvalue_vms
277                        )]);
278         if ($PLATFORM ne 'aix') {
279             skip_symbols [qw(
280                                 PL_DBcv
281                                 PL_generation
282                                 PL_lastgotoprobe
283                                 PL_modcount
284                                 PL_timesbuf
285                                 main
286                            )];
287         }
288     }
289 }
290
291 if ($PLATFORM ne 'vms') {
292     # VMS does its own thing for these symbols.
293     skip_symbols [qw(
294                         PL_sig_handlers_initted
295                         PL_sig_ignoring
296                         PL_sig_defaulting
297                    )];
298     if ($PLATFORM ne 'win32') {
299         skip_symbols [qw(
300                             Perl_do_spawn
301                             Perl_do_spawn_nowait
302                             Perl_do_aspawn
303                        )];
304     }
305 }
306
307 if ($PLATFORM eq 'os2') {
308     emit_symbols([qw(
309                     ctermid
310                     get_sysinfo
311                     Perl_OS2_init
312                     Perl_OS2_init3
313                     Perl_OS2_term
314                     OS2_Perl_data
315                     dlopen
316                     dlsym
317                     dlerror
318                     dlclose
319                     dup2
320                     dup
321                     my_tmpfile
322                     my_tmpnam
323                     my_flock
324                     my_rmdir
325                     my_mkdir
326                     my_getpwuid
327                     my_getpwnam
328                     my_getpwent
329                     my_setpwent
330                     my_endpwent
331                     fork_with_resources
332                     croak_with_os2error
333                     setgrent
334                     endgrent
335                     getgrent
336                     malloc_mutex
337                     threads_mutex
338                     nthreads
339                     nthreads_cond
340                     os2_cond_wait
341                     os2_stat
342                     os2_execname
343                     async_mssleep
344                     msCounter
345                     InfoTable
346                     pthread_join
347                     pthread_create
348                     pthread_detach
349                     XS_Cwd_change_drive
350                     XS_Cwd_current_drive
351                     XS_Cwd_extLibpath
352                     XS_Cwd_extLibpath_set
353                     XS_Cwd_sys_abspath
354                     XS_Cwd_sys_chdir
355                     XS_Cwd_sys_cwd
356                     XS_Cwd_sys_is_absolute
357                     XS_Cwd_sys_is_relative
358                     XS_Cwd_sys_is_rooted
359                     XS_DynaLoader_mod2fname
360                     XS_File__Copy_syscopy
361                     Perl_Register_MQ
362                     Perl_Deregister_MQ
363                     Perl_Serve_Messages
364                     Perl_Process_Messages
365                     init_PMWIN_entries
366                     PMWIN_entries
367                     Perl_hab_GET
368                     loadByOrdinal
369                     pExtFCN
370                     os2error
371                     ResetWinError
372                     CroakWinError
373                     PL_do_undump
374                     )]);
375     emit_symbols([qw(os2_cond_wait
376                      pthread_join
377                      pthread_create
378                      pthread_detach
379                     )])
380       if $define{'USE_5005THREADS'} or $define{'USE_ITHREADS'};
381 }
382 elsif ($PLATFORM eq 'vms') {
383     emit_symbols([qw(
384                         Perl_cando
385                         Perl_cando_by_name
386                         Perl_closedir
387                         Perl_csighandler_init
388                         Perl_do_rmdir
389                         Perl_fileify_dirspec
390                         Perl_fileify_dirspec_ts
391                         Perl_fileify_dirspec_utf8
392                         Perl_fileify_dirspec_utf8_ts
393                         Perl_flex_fstat
394                         Perl_flex_lstat
395                         Perl_flex_stat
396                         Perl_kill_file
397                         Perl_my_chdir
398                         Perl_my_chmod
399                         Perl_my_crypt
400                         Perl_my_endpwent
401                         Perl_my_fclose
402                         Perl_my_fdopen
403                         Perl_my_fgetname
404                         Perl_my_flush
405                         Perl_my_fwrite
406                         Perl_my_gconvert
407                         Perl_my_getenv
408                         Perl_my_getenv_len
409                         Perl_my_getlogin
410                         Perl_my_getpwnam
411                         Perl_my_getpwuid
412                         Perl_my_gmtime
413                         Perl_my_kill
414                         Perl_my_localtime
415                         Perl_my_mkdir
416                         Perl_my_sigaction 
417                         Perl_my_symlink
418                         Perl_my_time
419                         Perl_my_tmpfile
420                         Perl_my_trnlnm
421                         Perl_my_utime
422                         Perl_my_waitpid
423                         Perl_opendir
424                         Perl_pathify_dirspec
425                         Perl_pathify_dirspec_ts
426                         Perl_pathify_dirspec_utf8
427                         Perl_pathify_dirspec_utf8_ts
428                         Perl_readdir
429                         Perl_readdir_r
430                         Perl_rename
431                         Perl_rmscopy
432                         Perl_rmsexpand
433                         Perl_rmsexpand_ts
434                         Perl_rmsexpand_utf8
435                         Perl_rmsexpand_utf8_ts
436                         Perl_seekdir
437                         Perl_sig_to_vmscondition
438                         Perl_telldir
439                         Perl_tounixpath
440                         Perl_tounixpath_ts
441                         Perl_tounixpath_utf8
442                         Perl_tounixpath_utf8_ts
443                         Perl_tounixspec
444                         Perl_tounixspec_ts
445                         Perl_tounixspec_utf8
446                         Perl_tounixspec_utf8_ts
447                         Perl_tovmspath
448                         Perl_tovmspath_ts
449                         Perl_tovmspath_utf8
450                         Perl_tovmspath_utf8_ts
451                         Perl_tovmsspec
452                         Perl_tovmsspec_ts
453                         Perl_tovmsspec_utf8
454                         Perl_tovmsspec_utf8_ts
455                         Perl_trim_unixpath
456                         Perl_vms_case_tolerant
457                         Perl_vms_do_aexec
458                         Perl_vms_do_exec
459                         Perl_vms_image_init
460                         Perl_vms_realpath
461                         Perl_vmssetenv
462                         Perl_vmssetuserlnm
463                         Perl_vmstrnenv
464                         PerlIO_openn
465                      )]);
466 }
467
468 unless ($define{UNLINK_ALL_VERSIONS}) {
469     skip_symbols([qw(
470                      Perl_unlnk
471                      )])
472 }
473
474 unless ($define{'DEBUGGING'}) {
475     skip_symbols [qw(
476                     Perl_deb_growlevel
477                     Perl_debop
478                     Perl_debprofdump
479                     Perl_debstack
480                     Perl_debstackptrs
481                     Perl_pad_sv
482                     Perl_pad_setsv
483                     Perl_hv_assert
484                     PL_block_type
485                     PL_watchaddr
486                     PL_watchok
487                     PL_watch_pvx
488                     )];
489 }
490
491 if ($define{'PERL_IMPLICIT_CONTEXT'}) {
492     skip_symbols [qw(
493                     PL_sig_sv
494                     )];
495 }
496
497 if ($define{'PERL_IMPLICIT_SYS'}) {
498     skip_symbols [qw(
499                     Perl_my_popen
500                     Perl_my_pclose
501                     )];
502 }
503 else {
504     skip_symbols [qw(
505                     PL_Mem
506                     PL_MemShared
507                     PL_MemParse
508                     PL_Env
509                     PL_StdIO
510                     PL_LIO
511                     PL_Dir
512                     PL_Sock
513                     PL_Proc
514                     )];
515 }
516
517 unless ($define{'PERL_OLD_COPY_ON_WRITE'}) {
518     skip_symbols [qw(
519                     Perl_sv_setsv_cow
520                   )];
521 }
522
523 unless ($define{'USE_REENTRANT_API'}) {
524     skip_symbols [qw(
525                     PL_reentrant_buffer
526                     )];
527 }
528
529 if ($define{'MYMALLOC'}) {
530     emit_symbols [qw(
531                     Perl_dump_mstats
532                     Perl_get_mstats
533                     Perl_strdup
534                     Perl_putenv
535                     MallocCfg_ptr
536                     MallocCfgP_ptr
537                     )];
538     if ($define{'USE_ITHREADS'}) {
539         emit_symbols [qw(
540                         PL_malloc_mutex
541                         )];
542     }
543     else {
544         skip_symbols [qw(
545                         PL_malloc_mutex
546                         )];
547     }
548 }
549 else {
550     skip_symbols [qw(
551                     PL_malloc_mutex
552                     Perl_dump_mstats
553                     Perl_get_mstats
554                     Perl_malloced_size
555                     Perl_malloc_good_size
556                     MallocCfg_ptr
557                     MallocCfgP_ptr
558                     )];
559 }
560
561 if ($define{'PERL_USE_SAFE_PUTENV'}) {
562     skip_symbols [qw(
563                    PL_use_safe_putenv
564                   )];
565 }
566
567 unless ($define{'USE_ITHREADS'}) {
568     skip_symbols [qw(
569                     PL_thr_key
570                     )];
571 }
572
573 # USE_5005THREADS symbols. Kept as reference for easier removal
574     skip_symbols [qw(
575                     PL_sv_mutex
576                     PL_strtab_mutex
577                     PL_svref_mutex
578                     PL_cred_mutex
579                     PL_eval_mutex
580                     PL_fdpid_mutex
581                     PL_sv_lock_mutex
582                     PL_eval_cond
583                     PL_eval_owner
584                     PL_threads_mutex
585                     PL_nthreads
586                     PL_nthreads_cond
587                     PL_threadnum
588                     PL_threadsv_names
589                     PL_thrsv
590                     PL_vtbl_mutex
591                     Perl_condpair_magic
592                     Perl_new_struct_thread
593                     Perl_per_thread_magicals
594                     Perl_thread_create
595                     Perl_find_threadsv
596                     Perl_unlock_condpair
597                     Perl_magic_mutexfree
598                     Perl_sv_lock
599                     )];
600
601 unless ($define{'USE_ITHREADS'}) {
602     skip_symbols [qw(
603                     PL_op_mutex
604                     PL_regex_pad
605                     PL_regex_padav
606                     PL_sharedsv_space
607                     PL_sharedsv_space_mutex
608                     PL_dollarzero_mutex
609                     PL_hints_mutex
610                     PL_my_ctx_mutex
611                     PL_perlio_mutex
612                     Perl_clone_params_del
613                     Perl_clone_params_new
614                     Perl_parser_dup
615                     Perl_dirp_dup
616                     Perl_cx_dup
617                     Perl_si_dup
618                     Perl_any_dup
619                     Perl_ss_dup
620                     Perl_fp_dup
621                     Perl_gp_dup
622                     Perl_he_dup
623                     Perl_mg_dup
624                     Perl_mro_meta_dup
625                     Perl_re_dup_guts
626                     Perl_sv_dup
627                     Perl_sv_dup_inc
628                     Perl_rvpv_dup
629                     Perl_hek_dup
630                     Perl_sys_intern_dup
631                     perl_clone
632                     perl_clone_using
633                     Perl_sharedsv_find
634                     Perl_sharedsv_init
635                     Perl_sharedsv_lock
636                     Perl_sharedsv_new
637                     Perl_sharedsv_thrcnt_dec
638                     Perl_sharedsv_thrcnt_inc
639                     Perl_sharedsv_unlock
640                     Perl_stashpv_hvname_match
641                     Perl_regdupe_internal
642                     Perl_newPADOP
643                     )];
644 }
645
646 unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
647     skip_symbols [qw(
648                     PL_my_cxt_index
649                     PL_my_cxt_list
650                     PL_my_cxt_size
651                     PL_my_cxt_keys
652                     Perl_croak_nocontext
653                     Perl_die_nocontext
654                     Perl_deb_nocontext
655                     Perl_form_nocontext
656                     Perl_load_module_nocontext
657                     Perl_mess_nocontext
658                     Perl_warn_nocontext
659                     Perl_warner_nocontext
660                     Perl_newSVpvf_nocontext
661                     Perl_sv_catpvf_nocontext
662                     Perl_sv_setpvf_nocontext
663                     Perl_sv_catpvf_mg_nocontext
664                     Perl_sv_setpvf_mg_nocontext
665                     Perl_my_cxt_init
666                     Perl_my_cxt_index
667                     )];
668 }
669
670 unless ($define{'PERL_IMPLICIT_SYS'}) {
671     skip_symbols [qw(
672                     perl_alloc_using
673                     perl_clone_using
674                     )];
675 }
676
677 unless ($define{'PL_OP_SLAB_ALLOC'}) {
678     skip_symbols [qw(
679                      PL_OpPtr
680                      PL_OpSlab
681                      PL_OpSpace
682                      Perl_Slab_Alloc
683                      Perl_Slab_Free
684                     )];
685 }
686
687 unless ($define{'PERL_DEBUG_READONLY_OPS'}) {
688     skip_symbols [qw(
689                     PL_slab_count
690                     PL_slabs
691                   )];
692 }
693
694 unless ($define{'THREADS_HAVE_PIDS'}) {
695     skip_symbols [qw(PL_ppid)];
696 }
697
698 unless ($define{'PERL_NEED_APPCTX'}) {
699     skip_symbols [qw(
700                     PL_appctx
701                     )];
702 }
703
704 unless ($define{'PERL_NEED_TIMESBASE'}) {
705     skip_symbols [qw(
706                     PL_timesbase
707                     )];
708 }
709
710 unless ($define{'DEBUG_LEAKING_SCALARS'}) {
711     skip_symbols [qw(
712                     PL_sv_serial
713                     )];
714 }
715
716 unless ($define{'DEBUG_LEAKING_SCALARS_FORK_DUMP'}) {
717     skip_symbols [qw(
718                     PL_dumper_fd
719                     )];
720 }
721 unless ($define{'PERL_DONT_CREATE_GVSV'}) {
722     skip_symbols [qw(
723                      Perl_gv_SVadd
724                     )];
725 }
726 if ($define{'SPRINTF_RETURNS_STRLEN'}) {
727     skip_symbols [qw(
728                      Perl_my_sprintf
729                     )];
730 }
731 unless ($define{'PERL_USES_PL_PIDSTATUS'}) {
732     skip_symbols [qw(
733                      Perl_pidgone
734                      PL_pidstatus
735                     )];
736 }
737
738 unless ($define{'PERL_TRACK_MEMPOOL'}) {
739     skip_symbols [qw(
740                      PL_memory_debug_header
741                     )];
742 }
743
744 unless ($define{PERL_MAD}) {
745     skip_symbols [qw(
746                     PL_madskills
747                     PL_xmlfp
748                     Perl_pad_peg
749                     Perl_xmldump_indent
750                     Perl_xmldump_vindent
751                     Perl_xmldump_all
752                     Perl_xmldump_packsubs
753                     Perl_xmldump_sub
754                     Perl_xmldump_form
755                     Perl_xmldump_eval
756                     Perl_sv_catxmlsv
757                     Perl_sv_catxmlpvn
758                     Perl_sv_xmlpeek
759                     Perl_do_pmop_xmldump
760                     Perl_pmop_xmldump
761                     Perl_do_op_xmldump
762                     Perl_op_xmldump
763                     )];
764 }
765
766 unless ($define{'MULTIPLICITY'}) {
767     skip_symbols [qw(
768                     PL_interp_size
769                     PL_interp_size_5_16_0
770                     )];
771 }
772
773 unless ($define{'PERL_GLOBAL_STRUCT'}) {
774     skip_symbols [qw(
775                     PL_global_struct_size
776                     )];
777 }
778
779 unless ($define{'PERL_GLOBAL_STRUCT_PRIVATE'}) {
780     skip_symbols [qw(
781                     PL_my_cxt_keys
782                     Perl_my_cxt_index
783                     )];
784 }
785
786 unless ($define{HAS_MMAP}) {
787     skip_symbols [qw(
788                     PL_mmap_page_size
789                     )];
790 }
791
792 if ($define{HAS_SIGACTION}) {
793     skip_symbols [qw(
794                     PL_sig_trapped
795                     )];
796 }
797
798 unless ($define{USE_LOCALE_COLLATE}) {
799     skip_symbols [qw(
800                     PL_collation_ix
801                     PL_collation_name
802                     PL_collation_standard
803                     PL_collxfrm_base
804                     PL_collxfrm_mult
805                     Perl_sv_collxfrm
806                     Perl_sv_collxfrm_flags
807                     )];
808 }
809
810 unless ($define{USE_LOCALE_NUMERIC}) {
811     skip_symbols [qw(
812                     PL_numeric_local
813                     PL_numeric_name
814                     PL_numeric_radix_sv
815                     PL_numeric_standard
816                     )];
817 }
818
819 unless ($define{HAVE_INTERP_INTERN}) {
820     skip_symbols [qw(
821                     Perl_sys_intern_clear
822                     Perl_sys_intern_dup
823                     Perl_sys_intern_init
824                     PL_sys_intern
825                    )];
826 }
827
828 if ($define{HAS_SIGNBIT}) {
829     skip_symbols([qw(
830                         Perl_signbit
831                    )])
832 }
833
834 sub readvar {
835     my $file = shift;
836     my $proc = shift || sub { "PL_$_[2]" };
837     open(VARS,$file) || die "Cannot open $file: $!\n";
838     my @syms;
839     while (<VARS>) {
840         # All symbols have a Perl_ prefix because that's what embed.h
841         # sticks in front of them.  The A?I?S?C? is strictly speaking
842         # wrong.
843         push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?S?C?)\(([IGT])(\w+)/);
844     }
845     close(VARS);
846     return \@syms;
847 }
848
849 if ($define{'PERL_GLOBAL_STRUCT'}) {
850     my $global = readvar($perlvars_h);
851     skip_symbols $global;
852     emit_symbol('Perl_GetVars');
853     emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
854 } else {
855     skip_symbols [qw(Perl_init_global_struct Perl_free_global_struct)];
856 }
857
858 # functions from *.sym files
859
860 my @syms = ($global_sym, $globvar_sym);
861
862 # Symbols that are the public face of the PerlIO layers implementation
863 # These are in _addition to_ the public face of the abstraction
864 # and need to be exported to allow XS modules to implement layers
865 my @layer_syms = qw(
866                     PerlIOBase_binmode
867                     PerlIOBase_clearerr
868                     PerlIOBase_close
869                     PerlIOBase_dup
870                     PerlIOBase_eof
871                     PerlIOBase_error
872                     PerlIOBase_fileno
873                     PerlIOBase_noop_fail
874                     PerlIOBase_noop_ok
875                     PerlIOBase_popped
876                     PerlIOBase_pushed
877                     PerlIOBase_read
878                     PerlIOBase_setlinebuf
879                     PerlIOBase_unread
880                     PerlIOBuf_bufsiz
881                     PerlIOBuf_close
882                     PerlIOBuf_dup
883                     PerlIOBuf_fill
884                     PerlIOBuf_flush
885                     PerlIOBuf_get_base
886                     PerlIOBuf_get_cnt
887                     PerlIOBuf_get_ptr
888                     PerlIOBuf_open
889                     PerlIOBuf_popped
890                     PerlIOBuf_pushed
891                     PerlIOBuf_read
892                     PerlIOBuf_seek
893                     PerlIOBuf_set_ptrcnt
894                     PerlIOBuf_tell
895                     PerlIOBuf_unread
896                     PerlIOBuf_write
897                     PerlIO_allocate
898                     PerlIO_apply_layera
899                     PerlIO_apply_layers
900                     PerlIO_arg_fetch
901                     PerlIO_debug
902                     PerlIO_define_layer
903                     PerlIO_find_layer
904                     PerlIO_isutf8
905                     PerlIO_layer_fetch
906                     PerlIO_list_alloc
907                     PerlIO_list_free
908                     PerlIO_modestr
909                     PerlIO_parse_layers
910                     PerlIO_pending
911                     PerlIO_perlio
912                     PerlIO_pop
913                     PerlIO_push
914                     PerlIO_sv_dup
915                     Perl_PerlIO_clearerr
916                     Perl_PerlIO_close
917                     Perl_PerlIO_context_layers
918                     Perl_PerlIO_eof
919                     Perl_PerlIO_error
920                     Perl_PerlIO_fileno
921                     Perl_PerlIO_fill
922                     Perl_PerlIO_flush
923                     Perl_PerlIO_get_base
924                     Perl_PerlIO_get_bufsiz
925                     Perl_PerlIO_get_cnt
926                     Perl_PerlIO_get_ptr
927                     Perl_PerlIO_read
928                     Perl_PerlIO_seek
929                     Perl_PerlIO_set_cnt
930                     Perl_PerlIO_set_ptrcnt
931                     Perl_PerlIO_setlinebuf
932                     Perl_PerlIO_stderr
933                     Perl_PerlIO_stdin
934                     Perl_PerlIO_stdout
935                     Perl_PerlIO_tell
936                     Perl_PerlIO_unread
937                     Perl_PerlIO_write
938 );
939 if ($PLATFORM eq 'netware') {
940     push(@layer_syms,'PL_def_layerlist','PL_known_layers','PL_perlio');
941 }
942
943 if ($define{'USE_PERLIO'}) {
944     # Export the symols that make up the PerlIO abstraction, regardless
945     # of its implementation - read from a file
946     push @syms, $perlio_sym;
947
948     # This part is then dependent on how the abstraction is implemented
949     if ($define{'USE_SFIO'}) {
950         # Old legacy non-stdio "PerlIO"
951         skip_symbols \@layer_syms;
952         skip_symbols [qw(perlsio_binmode)];
953         # SFIO defines most of the PerlIO routines as macros
954         # So undo most of what $perlio_sym has just done - d'oh !
955         # Perhaps it would be better to list the ones which do exist
956         # And emit them
957         skip_symbols [qw(
958                          PerlIO_canset_cnt
959                          PerlIO_clearerr
960                          PerlIO_close
961                          PerlIO_eof
962                          PerlIO_error
963                          PerlIO_exportFILE
964                          PerlIO_fast_gets
965                          PerlIO_fdopen
966                          PerlIO_fileno
967                          PerlIO_findFILE
968                          PerlIO_flush
969                          PerlIO_get_base
970                          PerlIO_get_bufsiz
971                          PerlIO_get_cnt
972                          PerlIO_get_ptr
973                          PerlIO_getc
974                          PerlIO_getname
975                          PerlIO_has_base
976                          PerlIO_has_cntptr
977                          PerlIO_importFILE
978                          PerlIO_open
979                          PerlIO_printf
980                          PerlIO_putc
981                          PerlIO_puts
982                          PerlIO_read
983                          PerlIO_releaseFILE
984                          PerlIO_reopen
985                          PerlIO_rewind
986                          PerlIO_seek
987                          PerlIO_set_cnt
988                          PerlIO_set_ptrcnt
989                          PerlIO_setlinebuf
990                          PerlIO_sprintf
991                          PerlIO_stderr
992                          PerlIO_stdin
993                          PerlIO_stdout
994                          PerlIO_stdoutf
995                          PerlIO_tell
996                          PerlIO_ungetc
997                          PerlIO_vprintf
998                          PerlIO_write
999                          PerlIO_perlio
1000                          Perl_PerlIO_clearerr
1001                          Perl_PerlIO_close
1002                          Perl_PerlIO_eof
1003                          Perl_PerlIO_error
1004                          Perl_PerlIO_fileno
1005                          Perl_PerlIO_fill
1006                          Perl_PerlIO_flush
1007                          Perl_PerlIO_get_base
1008                          Perl_PerlIO_get_bufsiz
1009                          Perl_PerlIO_get_cnt
1010                          Perl_PerlIO_get_ptr
1011                          Perl_PerlIO_read
1012                          Perl_PerlIO_seek
1013                          Perl_PerlIO_set_cnt
1014                          Perl_PerlIO_set_ptrcnt
1015                          Perl_PerlIO_setlinebuf
1016                          Perl_PerlIO_stderr
1017                          Perl_PerlIO_stdin
1018                          Perl_PerlIO_stdout
1019                          Perl_PerlIO_tell
1020                          Perl_PerlIO_unread
1021                          Perl_PerlIO_write
1022                          PL_def_layerlist
1023                          PL_known_layers
1024                          PL_perlio
1025                          )];
1026     }
1027     else {
1028         # PerlIO with layers - export implementation
1029         emit_symbols \@layer_syms;
1030         emit_symbols [qw(perlsio_binmode)];
1031     }
1032     if ($define{'USE_ITHREADS'}) {
1033         emit_symbols [qw(
1034                         PL_perlio_mutex
1035                         )];
1036     }
1037     else {
1038         skip_symbols [qw(
1039                         PL_perlio_mutex
1040                         )];
1041     }
1042 } else {
1043         # -Uuseperlio
1044         # Skip the PerlIO layer symbols - although
1045         # nothing should have exported them anyway.
1046         skip_symbols \@layer_syms;
1047         skip_symbols [qw(
1048                         perlsio_binmode
1049                         PL_def_layerlist
1050                         PL_known_layers
1051                         PL_perlio
1052                         PL_perlio_debug_fd
1053                         PL_perlio_fd_refcnt
1054                         PL_perlio_fd_refcnt_size
1055                         )];
1056
1057         # Also do NOT add abstraction symbols from $perlio_sym
1058         # abstraction is done as #define to stdio
1059         # Remaining remnants that _may_ be functions
1060         # are handled in <DATA>
1061 }
1062
1063 for my $syms (@syms) {
1064     open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
1065     while (<GLOBAL>) {
1066         next if (!/^[A-Za-z]/);
1067         # Functions have a Perl_ prefix
1068         # Variables have a PL_ prefix
1069         chomp($_);
1070         my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
1071         $symbol .= $_;
1072         emit_symbol($symbol) unless exists $skip{$symbol};
1073     }
1074     close(GLOBAL);
1075 }
1076
1077 # variables
1078
1079 if ($define{'MULTIPLICITY'} && $define{PERL_GLOBAL_STRUCT}) {
1080     for my $f ($perlvars_h) {
1081         my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
1082         emit_symbols $glob;
1083     }
1084     # XXX AIX seems to want the perlvars.h symbols, for some reason
1085     if ($PLATFORM eq 'aix' or $PLATFORM eq 'os2') {     # OS/2 needs PL_thr_key
1086         my $glob = readvar($perlvars_h);
1087         emit_symbols $glob;
1088     }
1089 }
1090 else {
1091     unless ($define{'PERL_GLOBAL_STRUCT'}) {
1092         my $glob = readvar($perlvars_h);
1093         emit_symbols $glob;
1094     }
1095     unless ($define{MULTIPLICITY}) {
1096         my $glob = readvar($intrpvar_h);
1097         emit_symbols $glob;
1098     }
1099 }
1100
1101 sub try_symbol {
1102     my $symbol = shift;
1103
1104     return if $symbol !~ /^[A-Za-z_]/;
1105     return if $symbol =~ /^\#/;
1106     $symbol =~s/\r//g;
1107     chomp($symbol);
1108     return if exists $skip{$symbol};
1109     emit_symbol($symbol);
1110 }
1111
1112 while (<DATA>) {
1113     try_symbol($_);
1114 }
1115
1116 if ($PLATFORM eq 'win32') {
1117     try_symbol($_) foreach qw(
1118                                  setgid
1119                                  setuid
1120                                  win32_free_childdir
1121                                  win32_free_childenv
1122                                  win32_get_childdir
1123                                  win32_get_childenv
1124                                  win32_spawnvp
1125                             );
1126 }
1127
1128 if ($PLATFORM =~ /^win(?:32|ce)$/) {
1129     foreach my $symbol (qw(
1130                             Perl_init_os_extras
1131                             Perl_thread_create
1132                             Perl_win32_init
1133                             Perl_win32_term
1134                             RunPerl
1135                             win32_async_check
1136                             win32_errno
1137                             win32_environ
1138                             win32_abort
1139                             win32_fstat
1140                             win32_stat
1141                             win32_pipe
1142                             win32_popen
1143                             win32_pclose
1144                             win32_rename
1145                             win32_setmode
1146                             win32_chsize
1147                             win32_lseek
1148                             win32_tell
1149                             win32_dup
1150                             win32_dup2
1151                             win32_open
1152                             win32_close
1153                             win32_eof
1154                             win32_isatty
1155                             win32_read
1156                             win32_write
1157                             win32_mkdir
1158                             win32_rmdir
1159                             win32_chdir
1160                             win32_flock
1161                             win32_execv
1162                             win32_execvp
1163                             win32_htons
1164                             win32_ntohs
1165                             win32_htonl
1166                             win32_ntohl
1167                             win32_inet_addr
1168                             win32_inet_ntoa
1169                             win32_socket
1170                             win32_bind
1171                             win32_listen
1172                             win32_accept
1173                             win32_connect
1174                             win32_send
1175                             win32_sendto
1176                             win32_recv
1177                             win32_recvfrom
1178                             win32_shutdown
1179                             win32_closesocket
1180                             win32_ioctlsocket
1181                             win32_setsockopt
1182                             win32_getsockopt
1183                             win32_getpeername
1184                             win32_getsockname
1185                             win32_gethostname
1186                             win32_gethostbyname
1187                             win32_gethostbyaddr
1188                             win32_getprotobyname
1189                             win32_getprotobynumber
1190                             win32_getservbyname
1191                             win32_getservbyport
1192                             win32_select
1193                             win32_endhostent
1194                             win32_endnetent
1195                             win32_endprotoent
1196                             win32_endservent
1197                             win32_getnetent
1198                             win32_getnetbyname
1199                             win32_getnetbyaddr
1200                             win32_getprotoent
1201                             win32_getservent
1202                             win32_sethostent
1203                             win32_setnetent
1204                             win32_setprotoent
1205                             win32_setservent
1206                             win32_getenv
1207                             win32_putenv
1208                             win32_perror
1209                             win32_malloc
1210                             win32_calloc
1211                             win32_realloc
1212                             win32_free
1213                             win32_sleep
1214                             win32_times
1215                             win32_access
1216                             win32_alarm
1217                             win32_chmod
1218                             win32_open_osfhandle
1219                             win32_get_osfhandle
1220                             win32_ioctl
1221                             win32_link
1222                             win32_unlink
1223                             win32_utime
1224                             win32_gettimeofday
1225                             win32_uname
1226                             win32_wait
1227                             win32_waitpid
1228                             win32_kill
1229                             win32_str_os_error
1230                             win32_opendir
1231                             win32_readdir
1232                             win32_telldir
1233                             win32_seekdir
1234                             win32_rewinddir
1235                             win32_closedir
1236                             win32_longpath
1237                             win32_ansipath
1238                             win32_os_id
1239                             win32_getpid
1240                             win32_crypt
1241                             win32_dynaload
1242                             win32_clearenv
1243                             win32_stdin
1244                             win32_stdout
1245                             win32_stderr
1246                             win32_ferror
1247                             win32_feof
1248                             win32_strerror
1249                             win32_fprintf
1250                             win32_printf
1251                             win32_vfprintf
1252                             win32_vprintf
1253                             win32_fread
1254                             win32_fwrite
1255                             win32_fopen
1256                             win32_fdopen
1257                             win32_freopen
1258                             win32_fclose
1259                             win32_fputs
1260                             win32_fputc
1261                             win32_ungetc
1262                             win32_getc
1263                             win32_fileno
1264                             win32_clearerr
1265                             win32_fflush
1266                             win32_ftell
1267                             win32_fseek
1268                             win32_fgetpos
1269                             win32_fsetpos
1270                             win32_rewind
1271                             win32_tmpfile
1272                             win32_setbuf
1273                             win32_setvbuf
1274                             win32_flushall
1275                             win32_fcloseall
1276                             win32_fgets
1277                             win32_gets
1278                             win32_fgetc
1279                             win32_putc
1280                             win32_puts
1281                             win32_getchar
1282                             win32_putchar
1283                            ))
1284     {
1285         try_symbol($symbol);
1286     }
1287     if ($CCTYPE eq "BORLAND") {
1288         try_symbol('_matherr');
1289     }
1290 }
1291 elsif ($PLATFORM eq 'os2') {
1292     my (%mapped, @missing);
1293     open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1294     /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
1295     close MAP or die 'Cannot close miniperl.map';
1296
1297     @missing = grep { !exists $mapped{$_} }
1298                     keys %export;
1299     @missing = grep { !exists $exportperlmalloc{$_} } @missing;
1300     delete $export{$_} foreach @missing;
1301 }
1302 elsif ($PLATFORM eq 'netware') {
1303 foreach my $symbol (qw(
1304                         Perl_init_os_extras
1305                         Perl_thread_create
1306                         Perl_nw5_init
1307                         RunPerl
1308                         AllocStdPerl
1309                         FreeStdPerl
1310                         do_spawn2
1311                         do_aspawn
1312                         nw_uname
1313                         nw_stdin
1314                         nw_stdout
1315                         nw_stderr
1316                         nw_feof
1317                         nw_ferror
1318                         nw_fopen
1319                         nw_fclose
1320                         nw_clearerr
1321                         nw_getc
1322                         nw_fgets
1323                         nw_fputc
1324                         nw_fputs
1325                         nw_fflush
1326                         nw_ungetc
1327                         nw_fileno
1328                         nw_fdopen
1329                         nw_freopen
1330                         nw_fread
1331                         nw_fwrite
1332                         nw_setbuf
1333                         nw_setvbuf
1334                         nw_vfprintf
1335                         nw_ftell
1336                         nw_fseek
1337                         nw_rewind
1338                         nw_tmpfile
1339                         nw_fgetpos
1340                         nw_fsetpos
1341                         nw_dup
1342                         nw_access
1343                         nw_chmod
1344                         nw_chsize
1345                         nw_close
1346                         nw_dup2
1347                         nw_flock
1348                         nw_isatty
1349                         nw_link
1350                         nw_lseek
1351                         nw_stat
1352                         nw_mktemp
1353                         nw_open
1354                         nw_read
1355                         nw_rename
1356                         nw_setmode
1357                         nw_unlink
1358                         nw_utime
1359                         nw_write
1360                         nw_chdir
1361                         nw_rmdir
1362                         nw_closedir
1363                         nw_opendir
1364                         nw_readdir
1365                         nw_rewinddir
1366                         nw_seekdir
1367                         nw_telldir
1368                         nw_htonl
1369                         nw_htons
1370                         nw_ntohl
1371                         nw_ntohs
1372                         nw_accept
1373                         nw_bind
1374                         nw_connect
1375                         nw_endhostent
1376                         nw_endnetent
1377                         nw_endprotoent
1378                         nw_endservent
1379                         nw_gethostbyaddr
1380                         nw_gethostbyname
1381                         nw_gethostent
1382                         nw_gethostname
1383                         nw_getnetbyaddr
1384                         nw_getnetbyname
1385                         nw_getnetent
1386                         nw_getpeername
1387                         nw_getprotobyname
1388                         nw_getprotobynumber
1389                         nw_getprotoent
1390                         nw_getservbyname
1391                         nw_getservbyport
1392                         nw_getservent
1393                         nw_getsockname
1394                         nw_getsockopt
1395                         nw_inet_addr
1396                         nw_listen
1397                         nw_socket
1398                         nw_recv
1399                         nw_recvfrom
1400                         nw_select
1401                         nw_send
1402                         nw_sendto
1403                         nw_sethostent
1404                         nw_setnetent
1405                         nw_setprotoent
1406                         nw_setservent
1407                         nw_setsockopt
1408                         nw_inet_ntoa
1409                         nw_shutdown
1410                         nw_crypt
1411                         nw_execvp
1412                         nw_kill
1413                         nw_Popen
1414                         nw_Pclose
1415                         nw_Pipe
1416                         nw_times
1417                         nw_waitpid
1418                         nw_getpid
1419                         nw_spawnvp
1420                         nw_os_id
1421                         nw_open_osfhandle
1422                         nw_get_osfhandle
1423                         nw_abort
1424                         nw_sleep
1425                         nw_wait
1426                         nw_dynaload
1427                         nw_strerror
1428                         fnFpSetMode
1429                         fnInsertHashListAddrs
1430                         fnGetHashListAddrs
1431                         Perl_deb
1432                         Perl_sv_setsv
1433                         Perl_sv_catsv
1434                         Perl_sv_catpvn
1435                         Perl_sv_2pv
1436                         nw_freeenviron
1437                         Remove_Thread_Ctx
1438                            ))
1439     {
1440         try_symbol($symbol);
1441     }
1442 }
1443
1444 # records of type boot_module for statically linked modules (except Dynaloader)
1445 $static_ext =~ s/\//__/g;
1446 $static_ext =~ s/\bDynaLoader\b//;
1447 my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext;
1448 foreach my $symbol (@stat_mods)
1449     {
1450         try_symbol($symbol);
1451     }
1452
1453 try_symbol("init_Win32CORE") if $static_ext =~ /\bWin32CORE\b/;
1454
1455 # Now all symbols should be defined because
1456 # next we are going to output them.
1457
1458 foreach my $symbol (sort keys %export) {
1459     output_symbol($symbol);
1460 }
1461
1462 if ($PLATFORM eq 'os2') {
1463         print <<EOP;
1464     dll_perlmain=main
1465     fill_extLibpath
1466     dir_subst
1467     Perl_OS2_handler_install
1468
1469 ; LAST_ORDINAL=$sym_ord
1470 EOP
1471 }
1472
1473 sub emit_symbol {
1474     my $symbol = shift;
1475     chomp($symbol);
1476     $export{$symbol} = 1;
1477 }
1478
1479 sub output_symbol {
1480     my $symbol = shift;
1481     if ($PLATFORM =~ /^win(?:32|ce)$/) {
1482         $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
1483         print "\t$symbol\n";
1484 # XXX: binary compatibility between compilers is an exercise
1485 # in frustration :-(
1486 #        if ($CCTYPE eq "BORLAND") {
1487 #           # workaround Borland quirk by exporting both the straight
1488 #           # name and a name with leading underscore.  Note the
1489 #           # alias *must* come after the symbol itself, if both
1490 #           # are to be exported. (Linker bug?)
1491 #           print "\t_$symbol\n";
1492 #           print "\t$symbol = _$symbol\n";
1493 #       }
1494 #       elsif ($CCTYPE eq 'GCC') {
1495 #           # Symbols have leading _ whole process is $%@"% slow
1496 #           # so skip aliases for now
1497 #           nprint "\t$symbol\n";
1498 #       }
1499 #       else {
1500 #           # for binary coexistence, export both the symbol and
1501 #           # alias with leading underscore
1502 #           print "\t$symbol\n";
1503 #           print "\t_$symbol = $symbol\n";
1504 #       }
1505     }
1506     elsif ($PLATFORM eq 'os2') {
1507         printf qq(    %-31s \@%s\n),
1508           qq("$symbol"), $ordinal{$symbol} || ++$sym_ord;
1509         printf qq(    %-31s \@%s\n),
1510           qq("$exportperlmalloc{$symbol}" = "$symbol"),
1511           $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord
1512           if $exportperlmalloc and exists $exportperlmalloc{$symbol};
1513     }
1514     elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'vms') {
1515         print "$symbol\n";
1516     }
1517         elsif ($PLATFORM eq 'netware') {
1518         print "\t$symbol,\n";
1519         }
1520 }
1521
1522 1;
1523 __DATA__
1524 # Oddities from PerlIO
1525 PerlIO_binmode
1526 PerlIO_getpos
1527 PerlIO_init
1528 PerlIO_setpos
1529 PerlIO_sprintf
1530 PerlIO_sv_dup
1531 PerlIO_tmpfile
1532 PerlIO_vsprintf