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 | |
31fb1209 | 170 | Perl_Yes |
171 | Perl_No | |
172 | Perl_hexdigit | |
173 | Perl_patleave | |
174 | Perl_vert | |
0a753a76 | 175 | allgvs |
176 | curblock | |
0a753a76 | 177 | curcsv |
0a753a76 | 178 | lastretstr |
179 | mystack_mark | |
180 | perl_init_ext | |
181 | perl_requirepv | |
0a753a76 | 182 | stack |
ff0cee69 | 183 | statusvalue_vms |
0a753a76 | 184 | Perl_safexcalloc |
185 | Perl_safexmalloc | |
186 | Perl_safexfree | |
187 | Perl_safexrealloc | |
68dc0745 | 188 | Perl_my_memcmp |
8b10511d | 189 | Perl_my_memset |
68dc0745 | 190 | Perl_cshlen |
191 | Perl_cshname | |
0da3735a | 192 | Perl_opsave |
22239a37 | 193 | )]; |
0a753a76 | 194 | |
c69f112c | 195 | |
bbc8f9de | 196 | if ($define{'MYMALLOC'}) |
197 | { | |
22239a37 | 198 | skip_symbols [qw( |
199 | Perl_safefree | |
200 | Perl_safemalloc | |
201 | Perl_saferealloc | |
202 | Perl_safecalloc)]; | |
203 | emit_symbols [qw( | |
204 | Perl_malloc | |
205 | Perl_free | |
206 | Perl_realloc | |
207 | Perl_calloc)]; | |
bbc8f9de | 208 | } |
209 | ||
d55594ae | 210 | unless ($define{'USE_THREADS'}) |
211 | { | |
22239a37 | 212 | skip_symbols [qw( |
d55594ae | 213 | Perl_condpair_magic |
214 | Perl_thr_key | |
215 | Perl_sv_mutex | |
216 | Perl_malloc_mutex | |
217 | Perl_eval_mutex | |
218 | Perl_eval_cond | |
219 | Perl_eval_owner | |
220 | Perl_threads_mutex | |
32f822de | 221 | Perl_new_struct_thread |
222 | Perl_nthreads | |
d55594ae | 223 | Perl_nthreads_cond |
32f822de | 224 | Perl_per_thread_magicals |
d4cce5f1 | 225 | Perl_thread_create |
226 | Perl_find_threadsv | |
227 | Perl_threadsv_names | |
32f822de | 228 | Perl_thrsv |
d55594ae | 229 | Perl_unlock_condpair |
230 | Perl_vtbl_mutex | |
231 | Perl_magic_mutexfree | |
232 | Perl_sv_iv | |
233 | Perl_sv_nv | |
234 | Perl_sv_true | |
235 | Perl_sv_uv | |
236 | Perl_sv_pvn | |
22239a37 | 237 | Perl_newRV_noinc)]; |
d4cce5f1 | 238 | |
d55594ae | 239 | } |
240 | ||
22239a37 | 241 | sub readvar |
242 | { | |
243 | my $file = shift; | |
244 | open(VARS,$file) || die "Cannot open $file:$!"; | |
245 | my @syms; | |
246 | while (<VARS>) | |
247 | { | |
248 | # All symbols have a Perl_ prefix because that's what embed.h | |
249 | # sticks in front of them. | |
250 | push(@syms,"Perl_".$1) if (/\bPERLVARI?\([IGT](\w+)/); | |
251 | } | |
252 | close(VARS); | |
253 | return \@syms; | |
254 | } | |
255 | ||
d4cce5f1 | 256 | if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'}) |
d55594ae | 257 | { |
22239a37 | 258 | my $thrd = readvar("../thrdvar.h"); |
259 | skip_symbols $thrd; | |
d55594ae | 260 | } |
261 | ||
d4cce5f1 | 262 | if ($define{'MULTIPLICITY'}) |
d55594ae | 263 | { |
22239a37 | 264 | my $interp = readvar("../intrpvar.h"); |
265 | skip_symbols $interp; | |
266 | } | |
267 | ||
268 | if ($define{'PERL_GLOBAL_STRUCT'}) | |
269 | { | |
270 | my $global = readvar("../perlvars.h"); | |
271 | skip_symbols $global; | |
d4cce5f1 | 272 | } |
d55594ae | 273 | |
36c15d3f | 274 | unless ($define{'DEBUGGING'}) |
275 | { | |
22239a37 | 276 | skip_symbols [qw( |
277 | Perl_runops_debug | |
278 | Perl_sv_peek | |
279 | Perl_watchaddr | |
280 | Perl_watchok)]; | |
36c15d3f | 281 | } |
282 | ||
0a753a76 | 283 | open (GLOBAL, "<../global.sym") || die "failed to open global.sym" . $!; |
22239a37 | 284 | while (<GLOBAL>) |
285 | { | |
286 | next if (!/^[A-Za-z]/); | |
287 | next if (/_amg[ \t]*$/); | |
288 | # All symbols have a Perl_ prefix because that's what embed.h | |
289 | # sticks in front of them. | |
290 | chomp($_); | |
291 | my $symbol = "Perl_$_"; | |
292 | emit_symbol($symbol) unless exists $skip{$symbol}; | |
293 | } | |
0a753a76 | 294 | close(GLOBAL); |
295 | ||
296 | # also add symbols from interp.sym | |
297 | # They are only needed if -DMULTIPLICITY is not set but it | |
298 | # doesn't hurt to include them anyway. | |
299 | # these don't have Perl prefix | |
300 | ||
22239a37 | 301 | if ($define{'PERL_GLOBAL_STRUCT'}) |
302 | { | |
303 | emit_symbol( ($CCTYPE eq 'GCC') ? 'Perl_GetVars' : 'Perl_VarsPtr') | |
304 | } | |
305 | else | |
306 | { | |
307 | my $glob = readvar("../perlvars.h"); | |
308 | emit_symbols $glob; | |
309 | } | |
310 | ||
311 | unless ($define{'MULTIPLICITY'}) | |
312 | { | |
313 | my $glob = readvar("../intrpvar.h"); | |
314 | emit_symbols $glob; | |
315 | } | |
0a753a76 | 316 | |
22239a37 | 317 | unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'}) |
318 | { | |
319 | my $glob = readvar("../thrdvar.h"); | |
320 | emit_symbols $glob; | |
321 | } | |
0a753a76 | 322 | |
323 | while (<DATA>) { | |
324 | my $symbol; | |
325 | next if (!/^[A-Za-z]/); | |
326 | next if (/^#/); | |
a868473f | 327 | s/\r//g; |
22239a37 | 328 | chomp($_); |
0a753a76 | 329 | $symbol = $_; |
22239a37 | 330 | next if exists $skip{$symbol}; |
3e3baf6d | 331 | emit_symbol($symbol); |
332 | } | |
333 | ||
22239a37 | 334 | foreach my $symbol (sort keys %export) |
335 | { | |
3e3baf6d | 336 | if ($CCTYPE eq "BORLAND") { |
337 | # workaround Borland quirk by exporting both the straight | |
84902520 | 338 | # name and a name with leading underscore. Note the |
339 | # alias *must* come after the symbol itself, if both | |
340 | # are to be exported. (Linker bug?) | |
3e3baf6d | 341 | print "\t_$symbol\n"; |
84902520 | 342 | print "\t$symbol = _$symbol\n"; |
3e3baf6d | 343 | } |
22239a37 | 344 | elsif ($CCTYPE eq 'GCC') { |
345 | # Symbols have leading _ whole process is $%£"% slow | |
346 | # so skip aliases for now | |
347 | print "\t$symbol\n"; | |
348 | } | |
3e3baf6d | 349 | else { |
84902520 | 350 | # for binary coexistence, export both the symbol and |
351 | # alias with leading underscore | |
3e3baf6d | 352 | print "\t$symbol\n"; |
84902520 | 353 | print "\t_$symbol = $symbol\n"; |
3e3baf6d | 354 | } |
22239a37 | 355 | } |
356 | ||
357 | sub emit_symbol { | |
358 | my $symbol = shift; | |
359 | chomp($symbol); | |
360 | $export{$symbol} = 1; | |
3e3baf6d | 361 | } |
0a753a76 | 362 | |
363 | 1; | |
364 | __DATA__ | |
365 | # extra globals not included above. | |
366 | perl_init_i18nl10n | |
367 | perl_init_ext | |
368 | perl_alloc | |
369 | perl_construct | |
370 | perl_destruct | |
371 | perl_free | |
372 | perl_parse | |
373 | perl_run | |
374 | perl_get_sv | |
375 | perl_get_av | |
376 | perl_get_hv | |
377 | perl_get_cv | |
378 | perl_call_argv | |
379 | perl_call_pv | |
380 | perl_call_method | |
381 | perl_call_sv | |
10dd38fc | 382 | perl_require_pv |
383 | perl_eval_pv | |
384 | perl_eval_sv | |
d28b3ca3 | 385 | boot_DynaLoader |
d55594ae | 386 | Perl_thread_create |
68dc0745 | 387 | win32_errno |
96e4d5b1 | 388 | win32_environ |
68dc0745 | 389 | win32_stdin |
390 | win32_stdout | |
96e4d5b1 | 391 | win32_stderr |
68dc0745 | 392 | win32_ferror |
393 | win32_feof | |
394 | win32_strerror | |
395 | win32_fprintf | |
396 | win32_printf | |
397 | win32_vfprintf | |
96e4d5b1 | 398 | win32_vprintf |
68dc0745 | 399 | win32_fread |
400 | win32_fwrite | |
401 | win32_fopen | |
402 | win32_fdopen | |
403 | win32_freopen | |
404 | win32_fclose | |
405 | win32_fputs | |
406 | win32_fputc | |
407 | win32_ungetc | |
408 | win32_getc | |
409 | win32_fileno | |
410 | win32_clearerr | |
411 | win32_fflush | |
412 | win32_ftell | |
413 | win32_fseek | |
414 | win32_fgetpos | |
415 | win32_fsetpos | |
416 | win32_rewind | |
417 | win32_tmpfile | |
418 | win32_abort | |
419 | win32_fstat | |
96e4d5b1 | 420 | win32_stat |
68dc0745 | 421 | win32_pipe |
422 | win32_popen | |
423 | win32_pclose | |
424 | win32_setmode | |
96e4d5b1 | 425 | win32_lseek |
426 | win32_tell | |
68dc0745 | 427 | win32_dup |
428 | win32_dup2 | |
96e4d5b1 | 429 | win32_open |
430 | win32_close | |
431 | win32_eof | |
68dc0745 | 432 | win32_read |
433 | win32_write | |
3e3baf6d | 434 | win32_spawnvp |
5aabfad6 | 435 | win32_mkdir |
436 | win32_rmdir | |
437 | win32_chdir | |
c90c0ff4 | 438 | win32_flock |
6890e559 | 439 | win32_execvp |
54310121 | 440 | win32_htons |
441 | win32_ntohs | |
442 | win32_htonl | |
443 | win32_ntohl | |
444 | win32_inet_addr | |
445 | win32_inet_ntoa | |
446 | win32_socket | |
447 | win32_bind | |
448 | win32_listen | |
449 | win32_accept | |
450 | win32_connect | |
451 | win32_send | |
452 | win32_sendto | |
453 | win32_recv | |
454 | win32_recvfrom | |
455 | win32_shutdown | |
3a25acb4 | 456 | win32_closesocket |
54310121 | 457 | win32_ioctlsocket |
458 | win32_setsockopt | |
459 | win32_getsockopt | |
460 | win32_getpeername | |
461 | win32_getsockname | |
462 | win32_gethostname | |
463 | win32_gethostbyname | |
464 | win32_gethostbyaddr | |
465 | win32_getprotobyname | |
466 | win32_getprotobynumber | |
467 | win32_getservbyname | |
468 | win32_getservbyport | |
469 | win32_select | |
470 | win32_endhostent | |
471 | win32_endnetent | |
472 | win32_endprotoent | |
473 | win32_endservent | |
474 | win32_getnetent | |
475 | win32_getnetbyname | |
476 | win32_getnetbyaddr | |
477 | win32_getprotoent | |
478 | win32_getservent | |
479 | win32_sethostent | |
480 | win32_setnetent | |
481 | win32_setprotoent | |
482 | win32_setservent | |
ad2e33dc | 483 | win32_getenv |
84902520 | 484 | win32_perror |
485 | win32_setbuf | |
486 | win32_setvbuf | |
487 | win32_flushall | |
488 | win32_fcloseall | |
489 | win32_fgets | |
490 | win32_gets | |
491 | win32_fgetc | |
492 | win32_putc | |
493 | win32_puts | |
494 | win32_getchar | |
495 | win32_putchar | |
496 | win32_malloc | |
497 | win32_calloc | |
498 | win32_realloc | |
499 | win32_free | |
f3986ebb | 500 | win32_sleep |
501 | win32_times | |
502 | win32_alarm | |
65e48ea9 | 503 | win32_open_osfhandle |
504 | win32_get_osfhandle | |
ad2e33dc | 505 | Perl_win32_init |
f3986ebb | 506 | Perl_init_os_extras |
9811a7d7 | 507 | Perl_getTHR |
0fefa03b | 508 | Perl_setTHR |
84902520 | 509 | RunPerl |
22239a37 | 510 |