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 while (@ARGV && $ARGV[0] =~ /^-/)
20 $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
23 open(CFG,'config.h') || die "Cannot open config.h:$!";
26 $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
30 warn join(' ',keys %define)."\n";
32 my $CCTYPE = shift || "MSVC";
36 print "LIBRARY Perl\n";
37 print "DESCRIPTION 'Perl interpreter, export autogenerated'\n";
38 print "CODE LOADONCALL\n";
39 print "DATA LOADONCALL NONSHARED MULTIPLE\n";
43 $skip_sym=<<'!END!OF!SKIP!';
85 Perl_init_thread_intern
121 Perl_scan_inputsymbol
135 Perl_too_few_arguments
136 Perl_too_many_arguments
162 if ($CCTYPE eq 'GCC')
164 $skip_sym .= "Perl_na\n";
167 if ($define{'MYMALLOC'})
169 $skip_sym .= <<'!END!OF!SKIP!';
175 emit_symbol('Perl_malloc');
176 emit_symbol('Perl_free');
177 emit_symbol('Perl_realloc');
178 emit_symbol('Perl_calloc');
181 unless ($define{'USE_THREADS'})
183 $skip_sym .= <<'!END!OF!SKIP!';
192 Perl_new_struct_thread
195 Perl_per_thread_magicals
209 if ($define{'USE_THISPTR'} || $define{'USE_THREADS'})
211 open(THREAD,"<../thread.sym") || die "Cannot open thread.sym:$!";
214 next if (!/^[A-Za-z]/);
215 next if (/_amg[ \t]*$/);
216 $skip_sym .= "Perl_".$_;
219 $skip_sym .= "Perl_op\n";
222 unless ($define{'USE_THREADS'})
224 $skip_sym .= "Perl_thread_create\n";
225 $skip_sym .= "Perl_find_threadsv\n";
226 $skip_sym .= "Perl_threadsv_names\n";
229 # All symbols have a Perl_ prefix because that's what embed.h
230 # sticks in front of them.
233 open (GLOBAL, "<../global.sym") || die "failed to open global.sym" . $!;
236 next if (!/^[A-Za-z]/);
237 next if (/_amg[ \t]*$/);
239 next if ($skip_sym =~ m/$symbol/m);
240 emit_symbol($symbol);
244 # also add symbols from interp.sym
245 # They are only needed if -DMULTIPLICITY is not set but it
246 # doesn't hurt to include them anyway.
247 # these don't have Perl prefix
249 open (INTERP, "<../interp.sym") || die "failed to open interp.sym" . $!;
252 next if (!/^[A-Za-z]/);
253 next if (/_amg[ \t]*$/);
255 next if ($skip_sym =~ m/$symbol/m);
257 emit_symbol("Perl_" . $symbol);
264 next if (!/^[A-Za-z]/);
268 next if ($skip_sym =~ m/^$symbol/m);
269 $symbol = "Perl_".$symbol if ($define{'USE_THISPTR'}
270 && $symbol =~ /^perl/);
271 emit_symbol($symbol);
277 if ($CCTYPE eq "BORLAND") {
278 # workaround Borland quirk by exporting both the straight
279 # name and a name with leading underscore. Note the
280 # alias *must* come after the symbol itself, if both
281 # are to be exported. (Linker bug?)
282 print "\t_$symbol\n";
283 print "\t$symbol = _$symbol\n";
286 # for binary coexistence, export both the symbol and
287 # alias with leading underscore
289 print "\t_$symbol = $symbol\n";
295 # extra globals not included above.
396 win32_getprotobynumber