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