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