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