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