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