summaryrefslogtreecommitdiff
path: root/win32/makedef.pl
diff options
context:
space:
mode:
Diffstat (limited to 'win32/makedef.pl')
-rw-r--r--win32/makedef.pl169
1 files changed, 97 insertions, 72 deletions
diff --git a/win32/makedef.pl b/win32/makedef.pl
index f95d3747ed..dc0869a5c7 100644
--- a/win32/makedef.pl
+++ b/win32/makedef.pl
@@ -28,51 +28,50 @@ if ($define{PERL_OBJECT}) {
print "LIBRARY PerlCore\n";
print "DESCRIPTION 'Perl interpreter'\n";
print "EXPORTS\n";
- output_symbol("perl_alloc");
+# output_symbol("perl_alloc");
output_symbol("perl_get_host_info");
output_symbol("perl_alloc_using");
- output_symbol("perl_construct");
- output_symbol("perl_destruct");
- output_symbol("perl_free");
- output_symbol("perl_parse");
- output_symbol("perl_run");
- output_symbol("RunPerl");
+# output_symbol("perl_construct");
+# output_symbol("perl_destruct");
+# output_symbol("perl_free");
+# output_symbol("perl_parse");
+# output_symbol("perl_run");
+# output_symbol("RunPerl");
output_symbol("GetPerlInterpreter");
- exit(0);
+# exit(0);
+}
+else {
+ if ($CCTYPE ne 'GCC') {
+ print "LIBRARY Perl\n";
+ print "DESCRIPTION 'Perl interpreter, export autogenerated'\n";
+ }
+ else {
+ $define{'PERL_GLOBAL_STRUCT'} = 1;
+ $define{'MULTIPLICITY'} = 1;
+ }
+ print "EXPORTS\n";
}
-
-if ($CCTYPE ne 'GCC')
- {
- print "LIBRARY Perl\n";
- print "DESCRIPTION 'Perl interpreter, export autogenerated'\n";
- }
-else
- {
- $define{'PERL_GLOBAL_STRUCT'} = 1;
- $define{'MULTIPLICITY'} = 1;
- }
-
-print "EXPORTS\n";
my %skip;
my %export;
-sub skip_symbols
-{
- my $list = shift;
- foreach my $symbol (@$list)
- {
- $skip{$symbol} = 1;
- }
+sub skip_symbols {
+ my $list = shift;
+ foreach my $symbol (@$list) {
+ $skip{$symbol} = 1;
+ }
}
-sub emit_symbols
-{
- my $list = shift;
- foreach my $symbol (@$list)
- {
- emit_symbol($symbol) unless exists $skip{$symbol};
- }
+sub emit_symbols {
+ my $list = shift;
+ foreach my $symbol (@$list) {
+ my $skipsym = $symbol;
+ # XXX hack
+ if ($define{PERL_OBJECT}) {
+ $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
+ }
+ emit_symbol($symbol) unless exists $skip{$skipsym};
+ }
}
skip_symbols [qw(
@@ -120,6 +119,24 @@ PL_cshname
PL_opsave
)];
+if ($define{'PERL_OBJECT'}) {
+ skip_symbols [qw(
+ Perl_getenv_len
+ Perl_my_popen
+ Perl_my_pclose
+ )];
+}
+else {
+ skip_symbols [qw(
+ PL_Dir
+ PL_Env
+ PL_LIO
+ PL_Mem
+ PL_Proc
+ PL_Sock
+ PL_StdIO
+ )];
+}
if ($define{'MYMALLOC'})
{
@@ -194,13 +211,14 @@ unless ($define{'FAKE_THREADS'})
sub readvar
{
my $file = shift;
+ my $proc = shift || sub { "PL_$_[2]" };
open(VARS,$file) || die "Cannot open $file:$!";
my @syms;
while (<VARS>)
{
# All symbols have a Perl_ prefix because that's what embed.h
# sticks in front of them.
- push(@syms,"PL_".$1) if (/\bPERLVARI?C?\([IGT](\w+)/);
+ push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/);
}
close(VARS);
return \@syms;
@@ -267,23 +285,27 @@ for my $syms ('../global.sym','../pp.sym', '../globvar.sym')
# variables
-unless ($define{'PERL_GLOBAL_STRUCT'})
- {
- my $glob = readvar("../perlvars.h");
- emit_symbols $glob;
- }
-
-unless ($define{'MULTIPLICITY'})
- {
- my $glob = readvar("../intrpvar.h");
- emit_symbols $glob;
- }
-
-unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'})
- {
- my $glob = readvar("../thrdvar.h");
- emit_symbols $glob;
- }
+if ($define{'PERL_OBJECT'}) {
+ for my $f ("../perlvars.h", "../intrpvar.h", "../thrdvar.h") {
+ my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
+ emit_symbols $glob;
+ }
+}
+else {
+ unless ($define{'PERL_GLOBAL_STRUCT'}) {
+ my $glob = readvar("../perlvars.h");
+ emit_symbols $glob;
+ }
+ unless ($define{'MULTIPLICITY'}) {
+ my $glob = readvar("../intrpvar.h");
+ emit_symbols $glob;
+ }
+
+ unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'}) {
+ my $glob = readvar("../thrdvar.h");
+ emit_symbols $glob;
+ }
+}
while (<DATA>) {
my $symbol;
@@ -309,25 +331,28 @@ sub emit_symbol {
sub output_symbol {
my $symbol = shift;
- if ($CCTYPE eq "BORLAND") {
- # workaround Borland quirk by exporting both the straight
- # name and a name with leading underscore. Note the
- # alias *must* come after the symbol itself, if both
- # are to be exported. (Linker bug?)
- print "\t_$symbol\n";
- print "\t$symbol = _$symbol\n";
- }
- elsif ($CCTYPE eq 'GCC') {
- # Symbols have leading _ whole process is $%£"% slow
- # so skip aliases for now
- print "\t$symbol\n";
- }
- else {
- # for binary coexistence, export both the symbol and
- # alias with leading underscore
- print "\t$symbol\n";
- print "\t_$symbol = $symbol\n";
- }
+ print "\t$symbol\n";
+# XXX: binary compatibility between compilers is an exercise
+# in frustration :-(
+# if ($CCTYPE eq "BORLAND") {
+# # workaround Borland quirk by exporting both the straight
+# # name and a name with leading underscore. Note the
+# # alias *must* come after the symbol itself, if both
+# # are to be exported. (Linker bug?)
+# print "\t_$symbol\n";
+# print "\t$symbol = _$symbol\n";
+# }
+# elsif ($CCTYPE eq 'GCC') {
+# # Symbols have leading _ whole process is $%@"% slow
+# # so skip aliases for now
+# print "\t$symbol\n";
+# }
+# else {
+# # for binary coexistence, export both the symbol and
+# # alias with leading underscore
+# print "\t$symbol\n";
+# print "\t_$symbol = $symbol\n";
+# }
}
1;