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