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