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