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