This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
"Compiled" encodings.
[perl5.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 #
7 # reads global.sym, pp.sym, perlvars.h, intrpvar.h, thrdvar.h, config.h
8 # On OS/2 reads miniperl.map as well
9
10 my $PLATFORM;
11 my $CCTYPE;
12
13 my %bincompat5005 =
14       (
15        Perl_call_atexit         =>      "perl_atexit",
16        Perl_eval_sv             =>      "perl_eval_sv",
17        Perl_eval_pv             =>      "perl_eval_pv",
18        Perl_call_argv           =>      "perl_call_argv",
19        Perl_call_method         =>      "perl_call_method",
20        Perl_call_pv             =>      "perl_call_pv",
21        Perl_call_sv             =>      "perl_call_sv",
22        Perl_get_av              =>      "perl_get_av",
23        Perl_get_cv              =>      "perl_get_cv",
24        Perl_get_hv              =>      "perl_get_hv",
25        Perl_get_sv              =>      "perl_get_sv",
26        Perl_init_i18nl10n       =>      "perl_init_i18nl10n",
27        Perl_init_i18nl14n       =>      "perl_init_i18nl14n",
28        Perl_new_collate         =>      "perl_new_collate",
29        Perl_new_ctype           =>      "perl_new_ctype",
30        Perl_new_numeric         =>      "perl_new_numeric",
31        Perl_require_pv          =>      "perl_require_pv",
32        Perl_safesyscalloc       =>      "Perl_safecalloc",
33        Perl_safesysfree         =>      "Perl_safefree",
34        Perl_safesysmalloc       =>      "Perl_safemalloc",
35        Perl_safesysrealloc      =>      "Perl_saferealloc",
36        Perl_set_numeric_local   =>      "perl_set_numeric_local",
37        Perl_set_numeric_standard  =>    "perl_set_numeric_standard",
38        Perl_malloc              =>      "malloc",
39        Perl_mfree               =>      "free",
40        Perl_realloc             =>      "realloc",
41        Perl_calloc              =>      "calloc",
42       );
43
44 my $bincompat5005 = join("|", keys %bincompat5005);
45
46 while (@ARGV) {
47     my $flag = shift;
48     $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
49     $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/);
50     $CCTYPE   = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
51     $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
52 }
53
54 my @PLATFORM = qw(aix win32 os2);
55 my %PLATFORM;
56 @PLATFORM{@PLATFORM} = ();
57
58 defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
59 exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n"; 
60
61 my $config_sh   = "config.sh";
62 my $config_h    = "config.h";
63 my $thrdvar_h   = "thrdvar.h";
64 my $intrpvar_h  = "intrpvar.h";
65 my $perlvars_h  = "perlvars.h";
66 my $global_sym  = "global.sym";
67 my $pp_sym      = "pp.sym";
68 my $globvar_sym = "globvar.sym";
69 my $perlio_sym  = "perlio.sym";
70
71 if ($PLATFORM eq 'aix') { 
72     # Nothing for now.
73 }
74 elsif ($PLATFORM eq 'win32') {
75     $CCTYPE = "MSVC" unless defined $CCTYPE;
76     foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
77                 $pp_sym, $globvar_sym, $perlio_sym) {
78         s!^!..\\!;
79     }
80 }
81
82 unless ($PLATFORM eq 'win32') {
83     open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n";
84     while (<CFG>) {
85         if (/^(?:ccflags|optimize)='(.+)'$/) {
86             $_ = $1;
87             $define{$1} = 1 while /-D(\w+)/g;
88         }
89         if ($PLATFORM eq 'os2') {
90             $CONFIG_ARGS = $1 if /^(?:config_args)='(.+)'$/;
91             $ARCHNAME =    $1 if /^(?:archname)='(.+)'$/;
92         }
93     }
94     close(CFG);
95 }
96
97 open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
98 while (<CFG>) {
99     $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
100     $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
101     $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/;
102     $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/;
103 }
104 close(CFG);
105
106 # perl.h logic duplication begins
107
108 if ($define{USE_ITHREADS}) {
109     if (!$define{MULTIPLICITY} && !$define{PERL_OBJECT}) {
110         $define{MULTIPLICITY} = 1;
111     }
112 }
113
114 $define{PERL_IMPLICIT_CONTEXT} ||=
115     $define{USE_ITHREADS} ||
116     $define{USE_5005THREADS}  ||
117     $define{MULTIPLICITY} ;
118
119 if ($define{PERL_CAPI}) {
120     delete $define{PERL_OBJECT};
121     $define{MULTIPLICITY} = 1; 
122     $define{PERL_IMPLICIT_CONTEXT} = 1;
123     $define{PERL_IMPLICIT_SYS}     = 1;
124 }
125
126 if ($define{PERL_OBJECT}) {
127     $define{PERL_IMPLICIT_CONTEXT} = 1;
128     $define{PERL_IMPLICIT_SYS}     = 1;
129 }
130
131 # perl.h logic duplication ends
132
133 if ($PLATFORM eq 'win32') {
134     warn join(' ',keys %define)."\n";
135     print "LIBRARY Perl57\n";
136     print "DESCRIPTION 'Perl interpreter'\n";
137     print "EXPORTS\n";
138     if ($define{PERL_IMPLICIT_SYS}) {
139         output_symbol("perl_get_host_info");
140         output_symbol("perl_alloc_override");
141     }
142 }
143 elsif ($PLATFORM eq 'os2') {
144     ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
145     $v .= '-thread' if $ARCHNAME =~ /-thread/;
146     #$sum = 0;
147     #for (split //, $v) {
148     #   $sum = ($sum * 33) + ord;
149     #   $sum &= 0xffffff;
150     #}
151     #$sum += $sum >> 5;
152     #$sum &= 0xffff;
153     #$sum = printf '%X', $sum;
154     ($dll = $define{PERL_DLL}) =~ s/\.dll$//i;
155     # print STDERR "'$dll' <= '$define{PERL_DLL}'\n";
156     print <<"---EOP---";
157 LIBRARY '$dll' INITINSTANCE TERMINSTANCE
158 DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter'
159 STACKSIZE 32768
160 CODE LOADONCALL
161 DATA LOADONCALL NONSHARED MULTIPLE
162 EXPORTS
163 ---EOP---
164 }
165 elsif ($PLATFORM eq 'aix') {
166     print "#!\n";
167 }
168
169 my %skip;
170 my %export;
171
172 sub skip_symbols {
173     my $list = shift;
174     foreach my $symbol (@$list) {
175         $skip{$symbol} = 1;
176     }
177 }
178
179 sub emit_symbols {
180     my $list = shift;
181     foreach my $symbol (@$list) {
182         my $skipsym = $symbol;
183         # XXX hack
184         if ($define{PERL_OBJECT} || $define{MULTIPLICITY}) {
185             $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
186         }
187         emit_symbol($symbol) unless exists $skip{$skipsym};
188     }
189 }
190
191 if ($PLATFORM eq 'win32') {
192     skip_symbols [qw(
193                      PL_statusvalue_vms
194                      PL_archpat_auto
195                      PL_cryptseen
196                      PL_DBcv
197                      PL_generation
198                      PL_lastgotoprobe
199                      PL_linestart
200                      PL_modcount
201                      PL_pending_ident
202                      PL_sortcxix
203                      PL_sublex_info
204                      PL_timesbuf
205                      main
206                      Perl_ErrorNo
207                      Perl_GetVars
208                      Perl_do_exec3
209                      Perl_do_ipcctl
210                      Perl_do_ipcget
211                      Perl_do_msgrcv
212                      Perl_do_msgsnd
213                      Perl_do_semop
214                      Perl_do_shmio
215                      Perl_dump_fds
216                      Perl_init_thread_intern
217                      Perl_my_bzero
218                      Perl_my_htonl
219                      Perl_my_ntohl
220                      Perl_my_swap
221                      Perl_my_chsize
222                      Perl_same_dirent
223                      Perl_setenv_getix
224                      Perl_unlnk
225                      Perl_watch
226                      Perl_safexcalloc
227                      Perl_safexmalloc
228                      Perl_safexfree
229                      Perl_safexrealloc
230                      Perl_my_memcmp
231                      Perl_my_memset
232                      PL_cshlen
233                      PL_cshname
234                      PL_opsave
235                      Perl_do_exec
236                      Perl_getenv_len
237                      Perl_my_pclose
238                      Perl_my_popen
239                      )];
240 }
241 elsif ($PLATFORM eq 'aix') {
242     skip_symbols([qw(
243                      Perl_dump_fds
244                      Perl_ErrorNo
245                      Perl_GetVars
246                      Perl_my_bcopy
247                      Perl_my_bzero
248                      Perl_my_chsize
249                      Perl_my_htonl
250                      Perl_my_memcmp
251                      Perl_my_memset
252                      Perl_my_ntohl
253                      Perl_my_swap
254                      Perl_safexcalloc
255                      Perl_safexfree
256                      Perl_safexmalloc
257                      Perl_safexrealloc
258                      Perl_same_dirent
259                      Perl_unlnk
260                      Perl_sys_intern_clear
261                      Perl_sys_intern_dup
262                      Perl_sys_intern_init
263                      PL_cryptseen
264                      PL_opsave
265                      PL_statusvalue_vms
266                      PL_sys_intern
267                      )]);
268 }
269 elsif ($PLATFORM eq 'os2') {
270     emit_symbols([qw(
271                     ctermid
272                     get_sysinfo
273                     Perl_OS2_init
274                     OS2_Perl_data
275                     dlopen
276                     dlsym
277                     dlerror
278                     dlclose
279                     my_tmpfile
280                     my_tmpnam
281                     my_flock
282                     malloc_mutex
283                     threads_mutex
284                     nthreads
285                     nthreads_cond
286                     os2_cond_wait
287                     os2_stat
288                     pthread_join
289                     pthread_create
290                     pthread_detach
291                     XS_Cwd_change_drive
292                     XS_Cwd_current_drive
293                     XS_Cwd_extLibpath
294                     XS_Cwd_extLibpath_set
295                     XS_Cwd_sys_abspath
296                     XS_Cwd_sys_chdir
297                     XS_Cwd_sys_cwd
298                     XS_Cwd_sys_is_absolute
299                     XS_Cwd_sys_is_relative
300                     XS_Cwd_sys_is_rooted
301                     XS_DynaLoader_mod2fname
302                     XS_File__Copy_syscopy
303                     Perl_Register_MQ
304                     Perl_Deregister_MQ
305                     Perl_Serve_Messages
306                     Perl_Process_Messages
307                     init_PMWIN_entries
308                     PMWIN_entries
309                     Perl_hab_GET
310                     )]);
311 }
312
313 unless ($define{'DEBUGGING'}) {
314     skip_symbols [qw(
315                     Perl_deb_growlevel
316                     Perl_debop
317                     Perl_debprofdump
318                     Perl_debstack
319                     Perl_debstackptrs
320                     Perl_runops_debug
321                     Perl_sv_peek
322                     PL_block_type
323                     PL_watchaddr
324                     PL_watchok
325                     )];
326 }
327
328 if ($define{'PERL_IMPLICIT_SYS'}) {
329     skip_symbols [qw(
330                     Perl_getenv_len
331                     Perl_my_popen
332                     Perl_my_pclose
333                     )];
334 }
335 else {
336     skip_symbols [qw(
337                     PL_Mem
338                     PL_MemShared
339                     PL_MemParse
340                     PL_Env
341                     PL_StdIO
342                     PL_LIO
343                     PL_Dir
344                     PL_Sock
345                     PL_Proc
346                     )];
347 }
348
349 unless ($define{'PERL_FLEXIBLE_EXCEPTIONS'}) {
350     skip_symbols [qw(
351                     PL_protect
352                     Perl_default_protect
353                     Perl_vdefault_protect
354                     )];
355 }
356
357 if ($define{'MYMALLOC'}) {
358     emit_symbols [qw(
359                     Perl_dump_mstats
360                     Perl_get_mstats
361                     Perl_malloc
362                     Perl_mfree
363                     Perl_realloc
364                     Perl_calloc
365                     )];
366     if ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
367         emit_symbols [qw(
368                         PL_malloc_mutex
369                         )];
370     }
371     else {
372         skip_symbols [qw(
373                         PL_malloc_mutex
374                         )];
375     }
376 }
377 else {
378     skip_symbols [qw(
379                     PL_malloc_mutex
380                     Perl_dump_mstats
381                     Perl_get_mstats
382                     Perl_malloc
383                     Perl_mfree
384                     Perl_realloc
385                     Perl_calloc
386                     Perl_malloced_size
387                     )];
388 }
389
390 unless ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
391     skip_symbols [qw(
392                     PL_thr_key
393                     )];
394 }
395
396 unless ($define{'USE_5005THREADS'}) {
397     skip_symbols [qw(
398                     PL_sv_mutex
399                     PL_strtab_mutex
400                     PL_svref_mutex
401                     PL_cred_mutex
402                     PL_eval_mutex
403                     PL_fdpid_mutex
404                     PL_sv_lock_mutex
405                     PL_eval_cond
406                     PL_eval_owner
407                     PL_threads_mutex
408                     PL_nthreads
409                     PL_nthreads_cond
410                     PL_threadnum
411                     PL_threadsv_names
412                     PL_thrsv
413                     PL_vtbl_mutex
414                     Perl_condpair_magic
415                     Perl_new_struct_thread
416                     Perl_per_thread_magicals
417                     Perl_thread_create
418                     Perl_find_threadsv
419                     Perl_unlock_condpair
420                     Perl_magic_mutexfree
421                     Perl_sv_lock
422                     )];
423 }
424
425 unless ($define{'USE_ITHREADS'}) {
426     skip_symbols [qw(
427                     PL_ptr_table
428                     PL_op_mutex
429                     Perl_dirp_dup
430                     Perl_cx_dup
431                     Perl_si_dup
432                     Perl_any_dup
433                     Perl_ss_dup
434                     Perl_fp_dup
435                     Perl_gp_dup
436                     Perl_he_dup
437                     Perl_mg_dup
438                     Perl_re_dup
439                     Perl_sv_dup
440                     Perl_sys_intern_dup
441                     Perl_ptr_table_fetch
442                     Perl_ptr_table_new
443                     Perl_ptr_table_split
444                     Perl_ptr_table_store
445                     perl_clone
446                     perl_clone_using
447                     )];
448 }
449
450 unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
451     skip_symbols [qw(
452                     Perl_croak_nocontext
453                     Perl_die_nocontext
454                     Perl_deb_nocontext
455                     Perl_form_nocontext
456                     Perl_load_module_nocontext
457                     Perl_mess_nocontext
458                     Perl_warn_nocontext
459                     Perl_warner_nocontext
460                     Perl_newSVpvf_nocontext
461                     Perl_sv_catpvf_nocontext
462                     Perl_sv_setpvf_nocontext
463                     Perl_sv_catpvf_mg_nocontext
464                     Perl_sv_setpvf_mg_nocontext
465                     )];
466 }
467
468 unless ($define{'PERL_IMPLICIT_SYS'}) {
469     skip_symbols [qw(
470                     perl_alloc_using
471                     perl_clone_using
472                     )];
473 }
474
475 unless ($define{'FAKE_THREADS'}) {
476     skip_symbols [qw(PL_curthr)];
477 }
478
479 sub readvar {
480     my $file = shift;
481     my $proc = shift || sub { "PL_$_[2]" };
482     open(VARS,$file) || die "Cannot open $file: $!\n";
483     my @syms;
484     while (<VARS>) {
485         # All symbols have a Perl_ prefix because that's what embed.h
486         # sticks in front of them.
487         push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/);
488     } 
489     close(VARS); 
490     return \@syms;
491 }
492
493 if ($define{'USE_5005THREADS'}) {
494     my $thrd = readvar($thrdvar_h);
495     skip_symbols $thrd;
496 }
497
498 if ($define{'PERL_GLOBAL_STRUCT'}) {
499     my $global = readvar($perlvars_h);
500     skip_symbols $global;
501     emit_symbol('Perl_GetVars');
502     emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
503 }
504
505 # functions from *.sym files
506
507 my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
508
509 if ($define{'USE_PERLIO'}) {
510      push @syms, $perlio_sym;
511 }
512
513 for my $syms (@syms) {
514     open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
515     while (<GLOBAL>) {
516         next if (!/^[A-Za-z]/);
517         # Functions have a Perl_ prefix
518         # Variables have a PL_ prefix
519         chomp($_);
520         my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
521         $symbol .= $_;
522         emit_symbol($symbol) unless exists $skip{$symbol};
523     }
524     close(GLOBAL);
525 }
526
527 # variables
528
529 if ($define{'PERL_OBJECT'} || $define{'MULTIPLICITY'}) {
530     for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
531         my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
532         emit_symbols $glob;
533     }
534     # XXX AIX seems to want the perlvars.h symbols, for some reason
535     if ($PLATFORM eq 'aix') {
536         my $glob = readvar($perlvars_h);
537         emit_symbols $glob;
538     }
539 }
540 else {
541     unless ($define{'PERL_GLOBAL_STRUCT'}) {
542         my $glob = readvar($perlvars_h);
543         emit_symbols $glob;
544     } 
545     unless ($define{'MULTIPLICITY'}) {
546         my $glob = readvar($intrpvar_h);
547         emit_symbols $glob;
548     } 
549     unless ($define{'MULTIPLICITY'} || $define{'USE_5005THREADS'}) {
550         my $glob = readvar($thrdvar_h);
551         emit_symbols $glob;
552     } 
553 }
554
555 sub try_symbol {
556     my $symbol = shift;
557
558     return if $symbol !~ /^[A-Za-z]/;
559     return if $symbol =~ /^\#/;
560     $symbol =~s/\r//g;
561     chomp($symbol);
562     return if exists $skip{$symbol};
563     emit_symbol($symbol);
564 }
565
566 while (<DATA>) {
567     try_symbol($_);
568 }
569
570 if ($PLATFORM eq 'win32') {
571     foreach my $symbol (qw(
572                             setuid
573                             setgid
574                             boot_DynaLoader
575                             Perl_init_os_extras
576                             Perl_thread_create
577                             Perl_win32_init
578                             RunPerl
579                             win32_errno
580                             win32_environ
581                             win32_abort
582                             win32_fstat
583                             win32_stat
584                             win32_pipe
585                             win32_popen
586                             win32_pclose
587                             win32_rename
588                             win32_setmode
589                             win32_lseek
590                             win32_tell
591                             win32_dup
592                             win32_dup2
593                             win32_open
594                             win32_close
595                             win32_eof
596                             win32_read
597                             win32_write
598                             win32_spawnvp
599                             win32_mkdir
600                             win32_rmdir
601                             win32_chdir
602                             win32_flock
603                             win32_execv
604                             win32_execvp
605                             win32_htons
606                             win32_ntohs
607                             win32_htonl
608                             win32_ntohl
609                             win32_inet_addr
610                             win32_inet_ntoa
611                             win32_socket
612                             win32_bind
613                             win32_listen
614                             win32_accept
615                             win32_connect
616                             win32_send
617                             win32_sendto
618                             win32_recv
619                             win32_recvfrom
620                             win32_shutdown
621                             win32_closesocket
622                             win32_ioctlsocket
623                             win32_setsockopt
624                             win32_getsockopt
625                             win32_getpeername
626                             win32_getsockname
627                             win32_gethostname
628                             win32_gethostbyname
629                             win32_gethostbyaddr
630                             win32_getprotobyname
631                             win32_getprotobynumber
632                             win32_getservbyname
633                             win32_getservbyport
634                             win32_select
635                             win32_endhostent
636                             win32_endnetent
637                             win32_endprotoent
638                             win32_endservent
639                             win32_getnetent
640                             win32_getnetbyname
641                             win32_getnetbyaddr
642                             win32_getprotoent
643                             win32_getservent
644                             win32_sethostent
645                             win32_setnetent
646                             win32_setprotoent
647                             win32_setservent
648                             win32_getenv
649                             win32_putenv
650                             win32_perror
651                             win32_malloc
652                             win32_calloc
653                             win32_realloc
654                             win32_free
655                             win32_sleep
656                             win32_times
657                             win32_access
658                             win32_alarm
659                             win32_chmod
660                             win32_open_osfhandle
661                             win32_get_osfhandle
662                             win32_ioctl
663                             win32_link
664                             win32_unlink
665                             win32_utime
666                             win32_uname
667                             win32_wait
668                             win32_waitpid
669                             win32_kill
670                             win32_str_os_error
671                             win32_opendir
672                             win32_readdir
673                             win32_telldir
674                             win32_seekdir
675                             win32_rewinddir
676                             win32_closedir
677                             win32_longpath
678                             win32_os_id
679                             win32_getpid
680                             win32_crypt
681                             win32_dynaload
682
683                             win32_stdin
684                             win32_stdout
685                             win32_stderr
686                             win32_ferror
687                             win32_feof
688                             win32_strerror
689                             win32_fprintf
690                             win32_printf
691                             win32_vfprintf
692                             win32_vprintf
693                             win32_fread
694                             win32_fwrite
695                             win32_fopen
696                             win32_fdopen
697                             win32_freopen
698                             win32_fclose
699                             win32_fputs
700                             win32_fputc
701                             win32_ungetc
702                             win32_getc
703                             win32_fileno
704                             win32_clearerr
705                             win32_fflush
706                             win32_ftell
707                             win32_fseek
708                             win32_fgetpos
709                             win32_fsetpos
710                             win32_rewind
711                             win32_tmpfile
712                             win32_setbuf
713                             win32_setvbuf
714                             win32_flushall
715                             win32_fcloseall
716                             win32_fgets
717                             win32_gets
718                             win32_fgetc
719                             win32_putc
720                             win32_puts
721                             win32_getchar
722                             win32_putchar
723                            ))
724     {
725         try_symbol($symbol);
726     }
727 }
728 elsif ($PLATFORM eq 'os2') {
729     open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
730     /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
731     close MAP or die 'Cannot close miniperl.map';
732
733     @missing = grep { !exists $mapped{$_} and !exists $bincompat5005{$_} }
734                     keys %export;
735     delete $export{$_} foreach @missing;
736 }
737
738 # Now all symbols should be defined because
739 # next we are going to output them.
740
741 foreach my $symbol (sort keys %export) {
742     output_symbol($symbol);
743 }
744
745 sub emit_symbol {
746     my $symbol = shift;
747     chomp($symbol); 
748     $export{$symbol} = 1;
749 }
750
751 sub output_symbol {
752     my $symbol = shift;
753     $symbol = $bincompat5005{$symbol}
754         if $define{PERL_BINCOMPAT_5005} and $symbol =~ /^($bincompat5005)$/;
755     if ($PLATFORM eq 'win32') {
756         $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
757         print "\t$symbol\n";
758 # XXX: binary compatibility between compilers is an exercise
759 # in frustration :-(
760 #        if ($CCTYPE eq "BORLAND") {
761 #           # workaround Borland quirk by exporting both the straight
762 #           # name and a name with leading underscore.  Note the
763 #           # alias *must* come after the symbol itself, if both
764 #           # are to be exported. (Linker bug?)
765 #           print "\t_$symbol\n";
766 #           print "\t$symbol = _$symbol\n";
767 #       }
768 #       elsif ($CCTYPE eq 'GCC') {
769 #           # Symbols have leading _ whole process is $%@"% slow
770 #           # so skip aliases for now
771 #           nprint "\t$symbol\n";
772 #       }
773 #       else {
774 #           # for binary coexistence, export both the symbol and
775 #           # alias with leading underscore
776 #           print "\t$symbol\n";
777 #           print "\t_$symbol = $symbol\n";
778 #       }
779     }
780     elsif ($PLATFORM eq 'os2') {
781         print qq(    "$symbol"\n);
782     }
783     elsif ($PLATFORM eq 'aix') {
784         print "$symbol\n";
785     }
786 }
787
788 1;
789 __DATA__
790 # extra globals not included above.
791 perl_alloc
792 perl_alloc_using
793 perl_clone
794 perl_clone_using
795 perl_construct
796 perl_destruct
797 perl_free
798 perl_parse
799 perl_run