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