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