This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In makedef.pl, readvar now returns a list, not an array reference.
[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]" };
ac8f35e5
NC
781 open my $vars, '<', $file or die die "Cannot open $file: $!\n";
782
783 # All symbols have a Perl_ prefix because that's what embed.h sticks
784 # in front of them. The A?I?S?C? is strictly speaking wrong.
785 map {/\bPERLVAR(A?I?S?C?)\(([IGT])(\w+)/ ? &$proc($1,$2,$3) : ()} <$vars>;
7766f137
GS
786}
787
7766f137 788if ($define{'PERL_GLOBAL_STRUCT'}) {
ac8f35e5 789 skip_symbols [readvar($perlvars_h)];
7766f137
GS
790 emit_symbol('Perl_GetVars');
791 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
aadb217d
JH
792} else {
793 skip_symbols [qw(Perl_init_global_struct Perl_free_global_struct)];
7766f137 794}
36c15d3f 795
22c35a8c
GS
796# functions from *.sym files
797
7697f15a 798my @syms = ($global_sym, $globvar_sym);
549a6b10 799
d892637e
NIS
800# Symbols that are the public face of the PerlIO layers implementation
801# These are in _addition to_ the public face of the abstraction
802# and need to be exported to allow XS modules to implement layers
9df9a5cd 803my @layer_syms = qw(
db76e01e
JH
804 PerlIOBase_binmode
805 PerlIOBase_clearerr
806 PerlIOBase_close
807 PerlIOBase_dup
808 PerlIOBase_eof
809 PerlIOBase_error
810 PerlIOBase_fileno
811 PerlIOBase_noop_fail
812 PerlIOBase_noop_ok
813 PerlIOBase_popped
7e700b9a 814 PerlIOBase_pushed
db76e01e
JH
815 PerlIOBase_read
816 PerlIOBase_setlinebuf
817 PerlIOBase_unread
818 PerlIOBuf_bufsiz
819 PerlIOBuf_close
820 PerlIOBuf_dup
821 PerlIOBuf_fill
822 PerlIOBuf_flush
823 PerlIOBuf_get_base
824 PerlIOBuf_get_cnt
825 PerlIOBuf_get_ptr
826 PerlIOBuf_open
827 PerlIOBuf_popped
828 PerlIOBuf_pushed
829 PerlIOBuf_read
830 PerlIOBuf_seek
831 PerlIOBuf_set_ptrcnt
832 PerlIOBuf_tell
833 PerlIOBuf_unread
834 PerlIOBuf_write
835 PerlIO_allocate
8ffeedc3 836 PerlIO_apply_layera
db76e01e
JH
837 PerlIO_apply_layers
838 PerlIO_arg_fetch
839 PerlIO_debug
840 PerlIO_define_layer
4dcdb34a 841 PerlIO_find_layer
51d05609 842 PerlIO_isutf8
db76e01e 843 PerlIO_layer_fetch
4dcdb34a 844 PerlIO_list_alloc
db76e01e
JH
845 PerlIO_list_free
846 PerlIO_modestr
847 PerlIO_parse_layers
848 PerlIO_pending
849 PerlIO_perlio
850 PerlIO_pop
851 PerlIO_push
852 PerlIO_sv_dup
853 Perl_PerlIO_clearerr
854 Perl_PerlIO_close
188f0c84 855 Perl_PerlIO_context_layers
db76e01e
JH
856 Perl_PerlIO_eof
857 Perl_PerlIO_error
858 Perl_PerlIO_fileno
859 Perl_PerlIO_fill
860 Perl_PerlIO_flush
861 Perl_PerlIO_get_base
862 Perl_PerlIO_get_bufsiz
863 Perl_PerlIO_get_cnt
864 Perl_PerlIO_get_ptr
865 Perl_PerlIO_read
866 Perl_PerlIO_seek
867 Perl_PerlIO_set_cnt
868 Perl_PerlIO_set_ptrcnt
869 Perl_PerlIO_setlinebuf
870 Perl_PerlIO_stderr
871 Perl_PerlIO_stdin
872 Perl_PerlIO_stdout
873 Perl_PerlIO_tell
874 Perl_PerlIO_unread
875 Perl_PerlIO_write
9df9a5cd 876);
a5564b91
JH
877if ($PLATFORM eq 'netware') {
878 push(@layer_syms,'PL_def_layerlist','PL_known_layers','PL_perlio');
879}
d892637e 880
7766f137 881if ($define{'USE_PERLIO'}) {
d892637e
NIS
882 # Export the symols that make up the PerlIO abstraction, regardless
883 # of its implementation - read from a file
084592ab 884 push @syms, $perlio_sym;
d892637e
NIS
885
886 # This part is then dependent on how the abstraction is implemented
084592ab 887 if ($define{'USE_SFIO'}) {
d892637e 888 # Old legacy non-stdio "PerlIO"
9df9a5cd 889 skip_symbols \@layer_syms;
954fb84e 890 skip_symbols [qw(perlsio_binmode)];
084592ab 891 # SFIO defines most of the PerlIO routines as macros
d892637e
NIS
892 # So undo most of what $perlio_sym has just done - d'oh !
893 # Perhaps it would be better to list the ones which do exist
894 # And emit them
084592ab
CN
895 skip_symbols [qw(
896 PerlIO_canset_cnt
897 PerlIO_clearerr
898 PerlIO_close
899 PerlIO_eof
900 PerlIO_error
901 PerlIO_exportFILE
902 PerlIO_fast_gets
903 PerlIO_fdopen
904 PerlIO_fileno
905 PerlIO_findFILE
906 PerlIO_flush
907 PerlIO_get_base
908 PerlIO_get_bufsiz
909 PerlIO_get_cnt
910 PerlIO_get_ptr
911 PerlIO_getc
912 PerlIO_getname
913 PerlIO_has_base
914 PerlIO_has_cntptr
915 PerlIO_importFILE
916 PerlIO_open
917 PerlIO_printf
918 PerlIO_putc
919 PerlIO_puts
920 PerlIO_read
921 PerlIO_releaseFILE
922 PerlIO_reopen
923 PerlIO_rewind
924 PerlIO_seek
925 PerlIO_set_cnt
926 PerlIO_set_ptrcnt
927 PerlIO_setlinebuf
928 PerlIO_sprintf
929 PerlIO_stderr
930 PerlIO_stdin
931 PerlIO_stdout
932 PerlIO_stdoutf
933 PerlIO_tell
934 PerlIO_ungetc
935 PerlIO_vprintf
936 PerlIO_write
bcdb689b
JH
937 PerlIO_perlio
938 Perl_PerlIO_clearerr
939 Perl_PerlIO_close
940 Perl_PerlIO_eof
941 Perl_PerlIO_error
942 Perl_PerlIO_fileno
943 Perl_PerlIO_fill
944 Perl_PerlIO_flush
945 Perl_PerlIO_get_base
946 Perl_PerlIO_get_bufsiz
947 Perl_PerlIO_get_cnt
948 Perl_PerlIO_get_ptr
949 Perl_PerlIO_read
950 Perl_PerlIO_seek
951 Perl_PerlIO_set_cnt
952 Perl_PerlIO_set_ptrcnt
953 Perl_PerlIO_setlinebuf
954 Perl_PerlIO_stderr
955 Perl_PerlIO_stdin
956 Perl_PerlIO_stdout
957 Perl_PerlIO_tell
958 Perl_PerlIO_unread
959 Perl_PerlIO_write
ffcf5686
JH
960 PL_def_layerlist
961 PL_known_layers
962 PL_perlio
084592ab
CN
963 )];
964 }
d892637e
NIS
965 else {
966 # PerlIO with layers - export implementation
967 emit_symbols \@layer_syms;
954fb84e 968 emit_symbols [qw(perlsio_binmode)];
d892637e 969 }
f1791e53
RGS
970 if ($define{'USE_ITHREADS'}) {
971 emit_symbols [qw(
972 PL_perlio_mutex
973 )];
974 }
975 else {
976 skip_symbols [qw(
977 PL_perlio_mutex
978 )];
979 }
5138f914 980} else {
d892637e
NIS
981 # -Uuseperlio
982 # Skip the PerlIO layer symbols - although
aadb217d 983 # nothing should have exported them anyway.
9df9a5cd 984 skip_symbols \@layer_syms;
a6272963
SH
985 skip_symbols [qw(
986 perlsio_binmode
987 PL_def_layerlist
988 PL_known_layers
989 PL_perlio
990 PL_perlio_debug_fd
991 PL_perlio_fd_refcnt
992 PL_perlio_fd_refcnt_size
993 )];
1e8a8f59 994
d892637e
NIS
995 # Also do NOT add abstraction symbols from $perlio_sym
996 # abstraction is done as #define to stdio
bf09e1bd 997 # Remaining remnants that _may_ be functions are handled below.
9df9a5cd 998}
7766f137
GS
999
1000for my $syms (@syms) {
1001 open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
1002 while (<GLOBAL>) {
1003 next if (!/^[A-Za-z]/);
1004 # Functions have a Perl_ prefix
1005 # Variables have a PL_ prefix
1006 chomp($_);
1007 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
1008 $symbol .= $_;
1009 emit_symbol($symbol) unless exists $skip{$symbol};
1010 }
1011 close(GLOBAL);
1012}
0a753a76 1013
22c35a8c 1014# variables
0a753a76 1015
87b9e160
NC
1016if ($define{'MULTIPLICITY'} && $define{PERL_GLOBAL_STRUCT}) {
1017 for my $f ($perlvars_h) {
ac8f35e5 1018 emit_symbols [readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" })];
18c4b137 1019 }
1acb48c9 1020 # XXX AIX seems to want the perlvars.h symbols, for some reason
5c728af0 1021 if ($PLATFORM eq 'aix' or $PLATFORM eq 'os2') { # OS/2 needs PL_thr_key
ac8f35e5 1022 emit_symbols [readvar($perlvars_h)];
51371543
GS
1023 }
1024}
1025else {
1026 unless ($define{'PERL_GLOBAL_STRUCT'}) {
ac8f35e5 1027 emit_symbols [readvar($perlvars_h)];
9df9a5cd 1028 }
87b9e160 1029 unless ($define{MULTIPLICITY}) {
ac8f35e5 1030 emit_symbols [readvar($intrpvar_h)];
87b9e160 1031 }
51371543 1032}
0a753a76 1033
549a6b10
JH
1034sub try_symbol {
1035 my $symbol = shift;
22239a37 1036
4d6b4052 1037 return if $symbol !~ /^[A-Za-z_]/;
549a6b10
JH
1038 return if $symbol =~ /^\#/;
1039 $symbol =~s/\r//g;
1040 chomp($symbol);
43cd9f80 1041 return if exists $skip{$symbol};
549a6b10 1042 emit_symbol($symbol);
3e3baf6d 1043}
0a753a76 1044
bf09e1bd
NC
1045# Oddities from PerlIO
1046emit_symbols([qw(
1047 PerlIO_binmode
1048 PerlIO_getpos
1049 PerlIO_init
1050 PerlIO_setpos
1051 PerlIO_sprintf
1052 PerlIO_sv_dup
1053 PerlIO_tmpfile
1054 PerlIO_vsprintf
1055 )]);
ac4c12e7 1056
5581753c
NC
1057if ($PLATFORM eq 'win32') {
1058 try_symbol($_) foreach qw(
1059 setgid
1060 setuid
1061 win32_free_childdir
1062 win32_free_childenv
1063 win32_get_childdir
1064 win32_get_childenv
1065 win32_spawnvp
1066 );
1067}
1068
18f68570 1069if ($PLATFORM =~ /^win(?:32|ce)$/) {
549a6b10 1070 foreach my $symbol (qw(
7766f137 1071 Perl_init_os_extras
c44d3fdb 1072 Perl_thread_create
7766f137 1073 Perl_win32_init
23f519f0 1074 Perl_win32_term
7766f137 1075 RunPerl
5290524f 1076 win32_async_check
7766f137
GS
1077 win32_errno
1078 win32_environ
7766f137
GS
1079 win32_abort
1080 win32_fstat
1081 win32_stat
1082 win32_pipe
1083 win32_popen
1084 win32_pclose
1085 win32_rename
1086 win32_setmode
11bb82ff 1087 win32_chsize
7766f137
GS
1088 win32_lseek
1089 win32_tell
1090 win32_dup
1091 win32_dup2
1092 win32_open
1093 win32_close
1094 win32_eof
4342f4d6 1095 win32_isatty
7766f137
GS
1096 win32_read
1097 win32_write
7766f137
GS
1098 win32_mkdir
1099 win32_rmdir
1100 win32_chdir
1101 win32_flock
1102 win32_execv
1103 win32_execvp
1104 win32_htons
1105 win32_ntohs
1106 win32_htonl
1107 win32_ntohl
1108 win32_inet_addr
1109 win32_inet_ntoa
1110 win32_socket
1111 win32_bind
1112 win32_listen
1113 win32_accept
1114 win32_connect
1115 win32_send
1116 win32_sendto
1117 win32_recv
1118 win32_recvfrom
1119 win32_shutdown
1120 win32_closesocket
1121 win32_ioctlsocket
1122 win32_setsockopt
1123 win32_getsockopt
1124 win32_getpeername
1125 win32_getsockname
1126 win32_gethostname
1127 win32_gethostbyname
1128 win32_gethostbyaddr
1129 win32_getprotobyname
1130 win32_getprotobynumber
1131 win32_getservbyname
1132 win32_getservbyport
1133 win32_select
1134 win32_endhostent
1135 win32_endnetent
1136 win32_endprotoent
1137 win32_endservent
1138 win32_getnetent
1139 win32_getnetbyname
1140 win32_getnetbyaddr
1141 win32_getprotoent
1142 win32_getservent
1143 win32_sethostent
1144 win32_setnetent
1145 win32_setprotoent
1146 win32_setservent
1147 win32_getenv
1148 win32_putenv
1149 win32_perror
7766f137
GS
1150 win32_malloc
1151 win32_calloc
1152 win32_realloc
1153 win32_free
1154 win32_sleep
1155 win32_times
1156 win32_access
1157 win32_alarm
1158 win32_chmod
1159 win32_open_osfhandle
1160 win32_get_osfhandle
1161 win32_ioctl
1162 win32_link
1163 win32_unlink
1164 win32_utime
57ab3dfe 1165 win32_gettimeofday
7766f137
GS
1166 win32_uname
1167 win32_wait
1168 win32_waitpid
1169 win32_kill
1170 win32_str_os_error
1171 win32_opendir
1172 win32_readdir
1173 win32_telldir
1174 win32_seekdir
1175 win32_rewinddir
1176 win32_closedir
1177 win32_longpath
aa2b96ec 1178 win32_ansipath
7766f137
GS
1179 win32_os_id
1180 win32_getpid
1181 win32_crypt
1182 win32_dynaload
df3728a2 1183 win32_clearenv
00b02797
JH
1184 win32_stdin
1185 win32_stdout
1186 win32_stderr
1187 win32_ferror
1188 win32_feof
1189 win32_strerror
1190 win32_fprintf
1191 win32_printf
1192 win32_vfprintf
1193 win32_vprintf
1194 win32_fread
1195 win32_fwrite
1196 win32_fopen
1197 win32_fdopen
1198 win32_freopen
1199 win32_fclose
1200 win32_fputs
1201 win32_fputc
1202 win32_ungetc
1203 win32_getc
1204 win32_fileno
1205 win32_clearerr
1206 win32_fflush
1207 win32_ftell
1208 win32_fseek
1209 win32_fgetpos
1210 win32_fsetpos
1211 win32_rewind
1212 win32_tmpfile
1213 win32_setbuf
1214 win32_setvbuf
1215 win32_flushall
1216 win32_fcloseall
1217 win32_fgets
1218 win32_gets
1219 win32_fgetc
1220 win32_putc
1221 win32_puts
1222 win32_getchar
1223 win32_putchar
7766f137
GS
1224 ))
1225 {
549a6b10
JH
1226 try_symbol($symbol);
1227 }
3a00b83e
SH
1228 if ($CCTYPE eq "BORLAND") {
1229 try_symbol('_matherr');
1230 }
549a6b10 1231}
3cfae81b 1232elsif ($PLATFORM eq 'os2') {
3df97b6d 1233 my (%mapped, @missing);
7766f137
GS
1234 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1235 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
1236 close MAP or die 'Cannot close miniperl.map';
1237
ad6971c8 1238 @missing = grep { !exists $mapped{$_} }
7766f137 1239 keys %export;
c6261f3b 1240 @missing = grep { !exists $exportperlmalloc{$_} } @missing;
7766f137 1241 delete $export{$_} foreach @missing;
3cfae81b 1242}
2986a63f
JH
1243elsif ($PLATFORM eq 'netware') {
1244foreach my $symbol (qw(
2986a63f
JH
1245 Perl_init_os_extras
1246 Perl_thread_create
1247 Perl_nw5_init
1248 RunPerl
1249 AllocStdPerl
1250 FreeStdPerl
1251 do_spawn2
1252 do_aspawn
1253 nw_uname
1254 nw_stdin
1255 nw_stdout
1256 nw_stderr
1257 nw_feof
1258 nw_ferror
1259 nw_fopen
1260 nw_fclose
1261 nw_clearerr
1262 nw_getc
1263 nw_fgets
1264 nw_fputc
1265 nw_fputs
1266 nw_fflush
1267 nw_ungetc
1268 nw_fileno
1269 nw_fdopen
1270 nw_freopen
1271 nw_fread
1272 nw_fwrite
1273 nw_setbuf
1274 nw_setvbuf
1275 nw_vfprintf
1276 nw_ftell
1277 nw_fseek
1278 nw_rewind
1279 nw_tmpfile
1280 nw_fgetpos
1281 nw_fsetpos
1282 nw_dup
1283 nw_access
1284 nw_chmod
1285 nw_chsize
1286 nw_close
1287 nw_dup2
1288 nw_flock
1289 nw_isatty
1290 nw_link
1291 nw_lseek
1292 nw_stat
1293 nw_mktemp
1294 nw_open
1295 nw_read
1296 nw_rename
1297 nw_setmode
1298 nw_unlink
1299 nw_utime
1300 nw_write
1301 nw_chdir
1302 nw_rmdir
1303 nw_closedir
1304 nw_opendir
1305 nw_readdir
1306 nw_rewinddir
1307 nw_seekdir
1308 nw_telldir
1309 nw_htonl
1310 nw_htons
1311 nw_ntohl
1312 nw_ntohs
1313 nw_accept
1314 nw_bind
1315 nw_connect
1316 nw_endhostent
1317 nw_endnetent
1318 nw_endprotoent
1319 nw_endservent
1320 nw_gethostbyaddr
1321 nw_gethostbyname
1322 nw_gethostent
1323 nw_gethostname
1324 nw_getnetbyaddr
1325 nw_getnetbyname
1326 nw_getnetent
1327 nw_getpeername
1328 nw_getprotobyname
1329 nw_getprotobynumber
1330 nw_getprotoent
1331 nw_getservbyname
1332 nw_getservbyport
1333 nw_getservent
1334 nw_getsockname
1335 nw_getsockopt
1336 nw_inet_addr
1337 nw_listen
1338 nw_socket
1339 nw_recv
1340 nw_recvfrom
1341 nw_select
1342 nw_send
1343 nw_sendto
1344 nw_sethostent
1345 nw_setnetent
1346 nw_setprotoent
1347 nw_setservent
3a0827a6 1348 nw_setsockopt
4d76e4b4 1349 nw_inet_ntoa
2986a63f
JH
1350 nw_shutdown
1351 nw_crypt
1352 nw_execvp
1353 nw_kill
1354 nw_Popen
1355 nw_Pclose
1356 nw_Pipe
1357 nw_times
1358 nw_waitpid
1359 nw_getpid
1360 nw_spawnvp
1361 nw_os_id
1362 nw_open_osfhandle
1363 nw_get_osfhandle
1364 nw_abort
1365 nw_sleep
1366 nw_wait
1367 nw_dynaload
1368 nw_strerror
1369 fnFpSetMode
1370 fnInsertHashListAddrs
1371 fnGetHashListAddrs
1372 Perl_deb
011f1a1a
JH
1373 Perl_sv_setsv
1374 Perl_sv_catsv
1375 Perl_sv_catpvn
1376 Perl_sv_2pv
f355267c
JH
1377 nw_freeenviron
1378 Remove_Thread_Ctx
2986a63f
JH
1379 ))
1380 {
1381 try_symbol($symbol);
1382 }
1383}
22239a37 1384
d2b25974
VK
1385# records of type boot_module for statically linked modules (except Dynaloader)
1386$static_ext =~ s/\//__/g;
1387$static_ext =~ s/\bDynaLoader\b//;
1388my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext;
1389foreach my $symbol (@stat_mods)
1390 {
1391 try_symbol($symbol);
1392 }
1393
9fb265f7
JD
1394try_symbol("init_Win32CORE") if $static_ext =~ /\bWin32CORE\b/;
1395
549a6b10
JH
1396# Now all symbols should be defined because
1397# next we are going to output them.
1398
7766f137
GS
1399foreach my $symbol (sort keys %export) {
1400 output_symbol($symbol);
1401}
549a6b10 1402
011f1a1a 1403if ($PLATFORM eq 'os2') {
59ad941d
IZ
1404 print <<EOP;
1405 dll_perlmain=main
1933e12c
IZ
1406 fill_extLibpath
1407 dir_subst
1408 Perl_OS2_handler_install
1409
59ad941d
IZ
1410; LAST_ORDINAL=$sym_ord
1411EOP
2986a63f
JH
1412}
1413
549a6b10 1414sub emit_symbol {
7766f137 1415 my $symbol = shift;
9df9a5cd 1416 chomp($symbol);
7766f137 1417 $export{$symbol} = 1;
549a6b10
JH
1418}
1419
1420sub output_symbol {
1421 my $symbol = shift;
18f68570 1422 if ($PLATFORM =~ /^win(?:32|ce)$/) {
549a6b10 1423 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
520c758a 1424 print "\t$symbol\n";
549a6b10
JH
1425# XXX: binary compatibility between compilers is an exercise
1426# in frustration :-(
1427# if ($CCTYPE eq "BORLAND") {
1428# # workaround Borland quirk by exporting both the straight
1429# # name and a name with leading underscore. Note the
1430# # alias *must* come after the symbol itself, if both
1431# # are to be exported. (Linker bug?)
1432# print "\t_$symbol\n";
1433# print "\t$symbol = _$symbol\n";
1434# }
1435# elsif ($CCTYPE eq 'GCC') {
1436# # Symbols have leading _ whole process is $%@"% slow
1437# # so skip aliases for now
1438# nprint "\t$symbol\n";
1439# }
1440# else {
1441# # for binary coexistence, export both the symbol and
1442# # alias with leading underscore
1443# print "\t$symbol\n";
1444# print "\t_$symbol = $symbol\n";
1445# }
7766f137
GS
1446 }
1447 elsif ($PLATFORM eq 'os2') {
52e4c282
IZ
1448 printf qq( %-31s \@%s\n),
1449 qq("$symbol"), $ordinal{$symbol} || ++$sym_ord;
78232bc0
JH
1450 printf qq( %-31s \@%s\n),
1451 qq("$exportperlmalloc{$symbol}" = "$symbol"),
1452 $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord
1453 if $exportperlmalloc and exists $exportperlmalloc{$symbol};
7766f137 1454 }
93ea32b8 1455 elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'vms') {
549a6b10
JH
1456 print "$symbol\n";
1457 }
2986a63f
JH
1458 elsif ($PLATFORM eq 'netware') {
1459 print "\t$symbol,\n";
1460 }
549a6b10
JH
1461}
1462
14631;