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