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