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