Commit | Line | Data |
---|---|---|
0a753a76 | 1 | #!../miniperl |
2 | ||
3 | # Written: 10 April 1996 Gary Ng (71564.1743@compuserve.com) | |
4 | ||
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 | |
8 | ||
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. | |
12 | ||
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 | |
84902520 | 15 | # way to find them so I just put a exception list here |
0a753a76 | 16 | |
d55594ae | 17 | while (@ARGV && $ARGV[0] =~ /^-/) |
18 | { | |
19 | my $flag = shift; | |
20 | $define{$1} = 1 if ($flag =~ /^-D(\w+)$/); | |
21 | } | |
22 | ||
bbc8f9de | 23 | open(CFG,'config.h') || die "Cannot open config.h:$!"; |
24 | while (<CFG>) | |
25 | { | |
26 | $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/; | |
27 | } | |
28 | close(CFG); | |
29 | ||
d55594ae | 30 | warn join(' ',keys %define)."\n"; |
31 | ||
3e3baf6d | 32 | my $CCTYPE = shift || "MSVC"; |
33 | ||
04dc04aa | 34 | if ($CCTYPE ne 'GCC') |
35 | { | |
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"; | |
40 | } | |
22239a37 | 41 | else |
42 | { | |
43 | $define{'PERL_GLOBAL_STRUCT'} = 1; | |
44 | $define{'MULTIPLICITY'} = 1; | |
45 | } | |
46 | ||
bbc8f9de | 47 | print "EXPORTS\n"; |
48 | ||
22239a37 | 49 | my %skip; |
50 | my %export; | |
51 | ||
52 | sub skip_symbols | |
53 | { | |
54 | my $list = shift; | |
55 | foreach my $symbol (@$list) | |
56 | { | |
57 | $skip{$symbol} = 1; | |
58 | } | |
59 | } | |
60 | ||
61 | sub emit_symbols | |
62 | { | |
63 | my $list = shift; | |
64 | foreach my $symbol (@$list) | |
65 | { | |
66 | emit_symbol($symbol) unless exists $skip{$symbol}; | |
67 | } | |
68 | } | |
69 | ||
70 | skip_symbols [qw( | |
71 | Perl_statusvalue_vms | |
0a753a76 | 72 | Perl_block_type |
0a753a76 | 73 | Perl_additem |
74 | Perl_cast_ulong | |
75 | Perl_check_uni | |
76 | Perl_checkcomma | |
77 | Perl_chsize | |
78 | Perl_ck_aelem | |
79 | Perl_cryptseen | |
80 | Perl_cx_dump | |
81 | Perl_deb | |
82 | Perl_deb_growlevel | |
83 | Perl_debop | |
84 | Perl_debprofdump | |
85 | Perl_debstack | |
86 | Perl_debstackptrs | |
87 | Perl_do_ipcctl | |
88 | Perl_do_ipcget | |
89 | Perl_do_msgrcv | |
90 | Perl_do_msgsnd | |
91 | Perl_do_semop | |
92 | Perl_do_shmio | |
93 | Perl_doeval | |
94 | Perl_dofindlabel | |
95 | Perl_dopoptoeval | |
96 | Perl_dump_eval | |
97 | Perl_dump_fds | |
98 | Perl_dump_form | |
99 | Perl_dump_gv | |
100 | Perl_dump_mstats | |
101 | Perl_dump_op | |
102 | Perl_dump_packsubs | |
103 | Perl_dump_pm | |
104 | Perl_dump_sub | |
105 | Perl_expectterm | |
106 | Perl_fetch_gv | |
107 | Perl_fetch_io | |
108 | Perl_force_ident | |
109 | Perl_force_next | |
110 | Perl_force_word | |
111 | Perl_hv_stashpv | |
112 | Perl_intuit_more | |
d55594ae | 113 | Perl_init_thread_intern |
0a753a76 | 114 | Perl_know_next |
115 | Perl_modkids | |
116 | Perl_mstats | |
117 | Perl_my_bzero | |
118 | Perl_my_htonl | |
119 | Perl_my_ntohl | |
120 | Perl_my_swap | |
121 | Perl_my_chsize | |
122 | Perl_newXSUB | |
123 | Perl_no_fh_allowed | |
124 | Perl_no_op | |
125 | Perl_nointrp | |
126 | Perl_nomem | |
127 | Perl_pp_cswitch | |
128 | Perl_pp_entersubr | |
129 | Perl_pp_evalonce | |
130 | Perl_pp_interp | |
131 | Perl_pp_map | |
132 | Perl_pp_nswitch | |
133 | Perl_q | |
d55594ae | 134 | Perl_rcsid |
0a753a76 | 135 | Perl_reall_srchlen |
136 | Perl_regdump | |
137 | Perl_regfold | |
138 | Perl_regmyendp | |
139 | Perl_regmyp_size | |
140 | Perl_regmystartp | |
141 | Perl_regnarrate | |
142 | Perl_regprop | |
143 | Perl_same_dirent | |
144 | Perl_saw_return | |
145 | Perl_scan_const | |
146 | Perl_scan_formline | |
147 | Perl_scan_heredoc | |
148 | Perl_scan_ident | |
149 | Perl_scan_inputsymbol | |
150 | Perl_scan_pat | |
151 | Perl_scan_prefix | |
152 | Perl_scan_str | |
153 | Perl_scan_subst | |
154 | Perl_scan_trans | |
155 | Perl_scan_word | |
68dc0745 | 156 | Perl_setenv_getix |
0a753a76 | 157 | Perl_skipspace |
158 | Perl_sublex_done | |
159 | Perl_sublex_start | |
0a753a76 | 160 | Perl_sv_ref |
161 | Perl_sv_setptrobj | |
162 | Perl_timesbuf | |
163 | Perl_too_few_arguments | |
164 | Perl_too_many_arguments | |
165 | Perl_unlnk | |
166 | Perl_wait4pid | |
167 | Perl_watch | |
168 | Perl_yyname | |
169 | Perl_yyrule | |
170 | allgvs | |
171 | curblock | |
0a753a76 | 172 | curcsv |
0a753a76 | 173 | lastretstr |
174 | mystack_mark | |
175 | perl_init_ext | |
176 | perl_requirepv | |
0a753a76 | 177 | stack |
ff0cee69 | 178 | statusvalue_vms |
0a753a76 | 179 | Perl_safexcalloc |
180 | Perl_safexmalloc | |
181 | Perl_safexfree | |
182 | Perl_safexrealloc | |
68dc0745 | 183 | Perl_my_memcmp |
8b10511d | 184 | Perl_my_memset |
68dc0745 | 185 | Perl_cshlen |
186 | Perl_cshname | |
0da3735a | 187 | Perl_opsave |
22239a37 | 188 | )]; |
0a753a76 | 189 | |
c69f112c | 190 | |
bbc8f9de | 191 | if ($define{'MYMALLOC'}) |
192 | { | |
22239a37 | 193 | skip_symbols [qw( |
194 | Perl_safefree | |
195 | Perl_safemalloc | |
196 | Perl_saferealloc | |
197 | Perl_safecalloc)]; | |
198 | emit_symbols [qw( | |
199 | Perl_malloc | |
200 | Perl_free | |
201 | Perl_realloc | |
202 | Perl_calloc)]; | |
bbc8f9de | 203 | } |
204 | ||
d55594ae | 205 | unless ($define{'USE_THREADS'}) |
206 | { | |
22239a37 | 207 | skip_symbols [qw( |
d55594ae | 208 | Perl_condpair_magic |
209 | Perl_thr_key | |
210 | Perl_sv_mutex | |
211 | Perl_malloc_mutex | |
212 | Perl_eval_mutex | |
213 | Perl_eval_cond | |
214 | Perl_eval_owner | |
215 | Perl_threads_mutex | |
32f822de | 216 | Perl_new_struct_thread |
217 | Perl_nthreads | |
d55594ae | 218 | Perl_nthreads_cond |
32f822de | 219 | Perl_per_thread_magicals |
d4cce5f1 | 220 | Perl_thread_create |
221 | Perl_find_threadsv | |
222 | Perl_threadsv_names | |
32f822de | 223 | Perl_thrsv |
d55594ae | 224 | Perl_unlock_condpair |
225 | Perl_vtbl_mutex | |
226 | Perl_magic_mutexfree | |
227 | Perl_sv_iv | |
228 | Perl_sv_nv | |
229 | Perl_sv_true | |
230 | Perl_sv_uv | |
231 | Perl_sv_pvn | |
22239a37 | 232 | Perl_newRV_noinc)]; |
d4cce5f1 | 233 | |
d55594ae | 234 | } |
235 | ||
22239a37 | 236 | sub readvar |
237 | { | |
238 | my $file = shift; | |
239 | open(VARS,$file) || die "Cannot open $file:$!"; | |
240 | my @syms; | |
241 | while (<VARS>) | |
242 | { | |
243 | # All symbols have a Perl_ prefix because that's what embed.h | |
244 | # sticks in front of them. | |
245 | push(@syms,"Perl_".$1) if (/\bPERLVARI?\([IGT](\w+)/); | |
246 | } | |
247 | close(VARS); | |
248 | return \@syms; | |
249 | } | |
250 | ||
d4cce5f1 | 251 | if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'}) |
d55594ae | 252 | { |
22239a37 | 253 | my $thrd = readvar("../thrdvar.h"); |
254 | skip_symbols $thrd; | |
d55594ae | 255 | } |
256 | ||
d4cce5f1 | 257 | if ($define{'MULTIPLICITY'}) |
d55594ae | 258 | { |
22239a37 | 259 | my $interp = readvar("../intrpvar.h"); |
260 | skip_symbols $interp; | |
261 | } | |
262 | ||
263 | if ($define{'PERL_GLOBAL_STRUCT'}) | |
264 | { | |
265 | my $global = readvar("../perlvars.h"); | |
266 | skip_symbols $global; | |
d4cce5f1 | 267 | } |
d55594ae | 268 | |
36c15d3f | 269 | unless ($define{'DEBUGGING'}) |
270 | { | |
22239a37 | 271 | skip_symbols [qw( |
272 | Perl_runops_debug | |
273 | Perl_sv_peek | |
274 | Perl_watchaddr | |
275 | Perl_watchok)]; | |
36c15d3f | 276 | } |
277 | ||
0a753a76 | 278 | open (GLOBAL, "<../global.sym") || die "failed to open global.sym" . $!; |
22239a37 | 279 | while (<GLOBAL>) |
280 | { | |
281 | next if (!/^[A-Za-z]/); | |
282 | next if (/_amg[ \t]*$/); | |
283 | # All symbols have a Perl_ prefix because that's what embed.h | |
284 | # sticks in front of them. | |
285 | chomp($_); | |
286 | my $symbol = "Perl_$_"; | |
287 | emit_symbol($symbol) unless exists $skip{$symbol}; | |
288 | } | |
0a753a76 | 289 | close(GLOBAL); |
290 | ||
291 | # also add symbols from interp.sym | |
292 | # They are only needed if -DMULTIPLICITY is not set but it | |
293 | # doesn't hurt to include them anyway. | |
294 | # these don't have Perl prefix | |
295 | ||
22239a37 | 296 | if ($define{'PERL_GLOBAL_STRUCT'}) |
297 | { | |
298 | emit_symbol( ($CCTYPE eq 'GCC') ? 'Perl_GetVars' : 'Perl_VarsPtr') | |
299 | } | |
300 | else | |
301 | { | |
302 | my $glob = readvar("../perlvars.h"); | |
303 | emit_symbols $glob; | |
304 | } | |
305 | ||
306 | unless ($define{'MULTIPLICITY'}) | |
307 | { | |
308 | my $glob = readvar("../intrpvar.h"); | |
309 | emit_symbols $glob; | |
310 | } | |
0a753a76 | 311 | |
22239a37 | 312 | unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'}) |
313 | { | |
314 | my $glob = readvar("../thrdvar.h"); | |
315 | emit_symbols $glob; | |
316 | } | |
0a753a76 | 317 | |
318 | while (<DATA>) { | |
319 | my $symbol; | |
320 | next if (!/^[A-Za-z]/); | |
321 | next if (/^#/); | |
a868473f | 322 | s/\r//g; |
22239a37 | 323 | chomp($_); |
0a753a76 | 324 | $symbol = $_; |
22239a37 | 325 | next if exists $skip{$symbol}; |
3e3baf6d | 326 | emit_symbol($symbol); |
327 | } | |
328 | ||
22239a37 | 329 | foreach my $symbol (sort keys %export) |
330 | { | |
3e3baf6d | 331 | if ($CCTYPE eq "BORLAND") { |
332 | # workaround Borland quirk by exporting both the straight | |
84902520 | 333 | # name and a name with leading underscore. Note the |
334 | # alias *must* come after the symbol itself, if both | |
335 | # are to be exported. (Linker bug?) | |
3e3baf6d | 336 | print "\t_$symbol\n"; |
84902520 | 337 | print "\t$symbol = _$symbol\n"; |
3e3baf6d | 338 | } |
22239a37 | 339 | elsif ($CCTYPE eq 'GCC') { |
340 | # Symbols have leading _ whole process is $%£"% slow | |
341 | # so skip aliases for now | |
342 | print "\t$symbol\n"; | |
343 | } | |
3e3baf6d | 344 | else { |
84902520 | 345 | # for binary coexistence, export both the symbol and |
346 | # alias with leading underscore | |
3e3baf6d | 347 | print "\t$symbol\n"; |
84902520 | 348 | print "\t_$symbol = $symbol\n"; |
3e3baf6d | 349 | } |
22239a37 | 350 | } |
351 | ||
352 | sub emit_symbol { | |
353 | my $symbol = shift; | |
354 | chomp($symbol); | |
355 | $export{$symbol} = 1; | |
3e3baf6d | 356 | } |
0a753a76 | 357 | |
358 | 1; | |
359 | __DATA__ | |
360 | # extra globals not included above. | |
361 | perl_init_i18nl10n | |
362 | perl_init_ext | |
363 | perl_alloc | |
364 | perl_construct | |
365 | perl_destruct | |
366 | perl_free | |
367 | perl_parse | |
368 | perl_run | |
369 | perl_get_sv | |
370 | perl_get_av | |
371 | perl_get_hv | |
372 | perl_get_cv | |
373 | perl_call_argv | |
374 | perl_call_pv | |
375 | perl_call_method | |
376 | perl_call_sv | |
10dd38fc | 377 | perl_require_pv |
378 | perl_eval_pv | |
379 | perl_eval_sv | |
d28b3ca3 | 380 | boot_DynaLoader |
d55594ae | 381 | Perl_thread_create |
68dc0745 | 382 | win32_errno |
96e4d5b1 | 383 | win32_environ |
68dc0745 | 384 | win32_stdin |
385 | win32_stdout | |
96e4d5b1 | 386 | win32_stderr |
68dc0745 | 387 | win32_ferror |
388 | win32_feof | |
389 | win32_strerror | |
390 | win32_fprintf | |
391 | win32_printf | |
392 | win32_vfprintf | |
96e4d5b1 | 393 | win32_vprintf |
68dc0745 | 394 | win32_fread |
395 | win32_fwrite | |
396 | win32_fopen | |
397 | win32_fdopen | |
398 | win32_freopen | |
399 | win32_fclose | |
400 | win32_fputs | |
401 | win32_fputc | |
402 | win32_ungetc | |
403 | win32_getc | |
404 | win32_fileno | |
405 | win32_clearerr | |
406 | win32_fflush | |
407 | win32_ftell | |
408 | win32_fseek | |
409 | win32_fgetpos | |
410 | win32_fsetpos | |
411 | win32_rewind | |
412 | win32_tmpfile | |
413 | win32_abort | |
414 | win32_fstat | |
96e4d5b1 | 415 | win32_stat |
68dc0745 | 416 | win32_pipe |
417 | win32_popen | |
418 | win32_pclose | |
419 | win32_setmode | |
96e4d5b1 | 420 | win32_lseek |
421 | win32_tell | |
68dc0745 | 422 | win32_dup |
423 | win32_dup2 | |
96e4d5b1 | 424 | win32_open |
425 | win32_close | |
426 | win32_eof | |
68dc0745 | 427 | win32_read |
428 | win32_write | |
3e3baf6d | 429 | win32_spawnvp |
5aabfad6 | 430 | win32_mkdir |
431 | win32_rmdir | |
432 | win32_chdir | |
c90c0ff4 | 433 | win32_flock |
6890e559 | 434 | win32_execvp |
54310121 | 435 | win32_htons |
436 | win32_ntohs | |
437 | win32_htonl | |
438 | win32_ntohl | |
439 | win32_inet_addr | |
440 | win32_inet_ntoa | |
441 | win32_socket | |
442 | win32_bind | |
443 | win32_listen | |
444 | win32_accept | |
445 | win32_connect | |
446 | win32_send | |
447 | win32_sendto | |
448 | win32_recv | |
449 | win32_recvfrom | |
450 | win32_shutdown | |
3a25acb4 | 451 | win32_closesocket |
54310121 | 452 | win32_ioctlsocket |
453 | win32_setsockopt | |
454 | win32_getsockopt | |
455 | win32_getpeername | |
456 | win32_getsockname | |
457 | win32_gethostname | |
458 | win32_gethostbyname | |
459 | win32_gethostbyaddr | |
460 | win32_getprotobyname | |
461 | win32_getprotobynumber | |
462 | win32_getservbyname | |
463 | win32_getservbyport | |
464 | win32_select | |
465 | win32_endhostent | |
466 | win32_endnetent | |
467 | win32_endprotoent | |
468 | win32_endservent | |
469 | win32_getnetent | |
470 | win32_getnetbyname | |
471 | win32_getnetbyaddr | |
472 | win32_getprotoent | |
473 | win32_getservent | |
474 | win32_sethostent | |
475 | win32_setnetent | |
476 | win32_setprotoent | |
477 | win32_setservent | |
ad2e33dc | 478 | win32_getenv |
84902520 | 479 | win32_perror |
480 | win32_setbuf | |
481 | win32_setvbuf | |
482 | win32_flushall | |
483 | win32_fcloseall | |
484 | win32_fgets | |
485 | win32_gets | |
486 | win32_fgetc | |
487 | win32_putc | |
488 | win32_puts | |
489 | win32_getchar | |
490 | win32_putchar | |
491 | win32_malloc | |
492 | win32_calloc | |
493 | win32_realloc | |
494 | win32_free | |
f3986ebb | 495 | win32_sleep |
496 | win32_times | |
497 | win32_alarm | |
65e48ea9 | 498 | win32_open_osfhandle |
499 | win32_get_osfhandle | |
ad2e33dc | 500 | Perl_win32_init |
f3986ebb | 501 | Perl_init_os_extras |
9811a7d7 | 502 | Perl_getTHR |
0fefa03b | 503 | Perl_setTHR |
84902520 | 504 | RunPerl |
22239a37 | 505 |