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