3 # Written: 10 April 1996 Gary Ng (71564.1743@compuserve.com)
5 # Create the export list for perl.
6 # Needed by WIN32 for creating perl.dll
7 # based on perl_exp.SH in the main perl distribution directory
9 # This simple program relys on 'global.sym' being up to date
10 # with all of the global symbols that a dynamicly link library
11 # might want to access.
13 # There is some symbol defined in global.sym and interp.sym
14 # that does not present in the WIN32 port but there is no easy
15 # way to find them so I just put a exception list here
17 my $CCTYPE = "MSVC"; # default
22 $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
23 $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
26 open(CFG,'config.h') || die "Cannot open config.h:$!";
29 $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
30 $define{$1} = 1 if /^\s*#\s*define\s+(USE_THREADS)\b/;
31 $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
35 warn join(' ',keys %define)."\n";
37 if ($define{PERL_OBJECT}) {
38 print "LIBRARY PerlCore\n";
39 print "DESCRIPTION 'Perl interpreter'\n";
41 output_symbol("perl_alloc");
47 print "LIBRARY Perl\n";
48 print "DESCRIPTION 'Perl interpreter, export autogenerated'\n";
52 $define{'PERL_GLOBAL_STRUCT'} = 1;
53 $define{'MULTIPLICITY'} = 1;
64 foreach my $symbol (@$list)
73 foreach my $symbol (@$list)
75 emit_symbol($symbol) unless exists $skip{$symbol};
126 Perl_init_thread_intern
154 Perl_scan_inputsymbol
168 Perl_too_few_arguments
169 Perl_too_many_arguments
194 if ($define{'MYMALLOC'})
210 Perl_malloced_size)];
213 unless ($define{'USE_THREADS'})
235 Perl_new_struct_thread
236 Perl_per_thread_magicals
244 unless ($define{'FAKE_THREADS'})
246 skip_symbols [qw(PL_curthr)];
252 open(VARS,$file) || die "Cannot open $file:$!";
256 # All symbols have a Perl_ prefix because that's what embed.h
257 # sticks in front of them.
258 push(@syms,"PL_".$1) if (/\bPERLVARI?C?\([IGT](\w+)/);
264 if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'})
266 my $thrd = readvar("../thrdvar.h");
270 if ($define{'MULTIPLICITY'})
272 my $interp = readvar("../intrpvar.h");
273 skip_symbols $interp;
276 if ($define{'PERL_GLOBAL_STRUCT'})
278 my $global = readvar("../perlvars.h");
279 skip_symbols $global;
280 emit_symbols [qw(Perl_GetVars)];
281 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
284 unless ($define{'DEBUGGING'})
299 if ($define{'HAVE_DES_FCRYPT'})
301 emit_symbols [qw(win32_crypt)];
304 open (GLOBAL, "<../global.sym") || die "failed to open global.sym" . $!;
307 next if (!/^[A-Za-z]/);
308 next if (/_amg[ \t]*$/);
309 # All symbols have a Perl_ prefix because that's what embed.h
310 # sticks in front of them.
312 my $symbol = "Perl_$_";
313 emit_symbol($symbol) unless exists $skip{$symbol};
317 # also add symbols from interp.sym
318 # They are only needed if -DMULTIPLICITY is not set but it
319 # doesn't hurt to include them anyway.
320 # these don't have Perl prefix
322 unless ($define{'PERL_GLOBAL_STRUCT'})
324 my $glob = readvar("../perlvars.h");
328 unless ($define{'MULTIPLICITY'})
330 my $glob = readvar("../intrpvar.h");
334 unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'})
336 my $glob = readvar("../thrdvar.h");
342 next if (!/^[A-Za-z]/);
347 next if exists $skip{$symbol};
348 emit_symbol($symbol);
351 foreach my $symbol (sort keys %export)
353 output_symbol($symbol);
359 $export{$symbol} = 1;
364 if ($CCTYPE eq "BORLAND") {
365 # workaround Borland quirk by exporting both the straight
366 # name and a name with leading underscore. Note the
367 # alias *must* come after the symbol itself, if both
368 # are to be exported. (Linker bug?)
369 print "\t_$symbol\n";
370 print "\t$symbol = _$symbol\n";
372 elsif ($CCTYPE eq 'GCC') {
373 # Symbols have leading _ whole process is $%£"% slow
374 # so skip aliases for now
378 # for binary coexistence, export both the symbol and
379 # alias with leading underscore
381 print "\t_$symbol = $symbol\n";
387 # extra globals not included above.
411 perl_set_numeric_standard
412 perl_set_numeric_local
496 win32_getprotobynumber