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