Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "ExtUtils::Embed 3" | |
132 | .TH ExtUtils::Embed 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide" | |
133 | .SH "NAME" | |
134 | ExtUtils::Embed \- Utilities for embedding Perl in C/C++ applications | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | .Vb 3 | |
138 | \& perl -MExtUtils::Embed -e xsinit | |
139 | \& perl -MExtUtils::Embed -e ccopts | |
140 | \& perl -MExtUtils::Embed -e ldopts | |
141 | .Ve | |
142 | .SH "DESCRIPTION" | |
143 | .IX Header "DESCRIPTION" | |
144 | ExtUtils::Embed provides utility functions for embedding a Perl interpreter | |
145 | and extensions in your C/\*(C+ applications. | |
146 | Typically, an application \fBMakefile\fR will invoke ExtUtils::Embed | |
147 | functions while building your application. | |
148 | .SH "@EXPORT" | |
149 | .IX Header "@EXPORT" | |
150 | ExtUtils::Embed exports the following functions: | |
151 | .PP | |
152 | \&\fIxsinit()\fR, \fIldopts()\fR, \fIccopts()\fR, \fIperl_inc()\fR, \fIccflags()\fR, | |
153 | \&\fIccdlflags()\fR, \fIxsi_header()\fR, \fIxsi_protos()\fR, \fIxsi_body()\fR | |
154 | .SH "FUNCTIONS" | |
155 | .IX Header "FUNCTIONS" | |
156 | .IP "\fIxsinit()\fR" 4 | |
157 | .IX Item "xsinit()" | |
158 | Generate C/\*(C+ code for the \s-1XS\s0 initializer function. | |
159 | .Sp | |
160 | When invoked as \f(CW`perl \-MExtUtils::Embed \-e xsinit \-\-`\fR | |
161 | the following options are recognized: | |
162 | .Sp | |
163 | \&\fB\-o\fR <output filename> (Defaults to \fBperlxsi.c\fR) | |
164 | .Sp | |
165 | \&\fB\-o \s-1STDOUT\s0\fR will print to \s-1STDOUT\s0. | |
166 | .Sp | |
167 | \&\fB\-std\fR (Write code for extensions that are linked with the current Perl.) | |
168 | .Sp | |
169 | Any additional arguments are expected to be names of modules | |
170 | to generate code for. | |
171 | .Sp | |
172 | When invoked with parameters the following are accepted and optional: | |
173 | .Sp | |
174 | \&\f(CW\*(C`xsinit($filename,$std,[@modules])\*(C'\fR | |
175 | .Sp | |
176 | Where, | |
177 | .Sp | |
178 | \&\fB$filename\fR is equivalent to the \fB\-o\fR option. | |
179 | .Sp | |
180 | \&\fB$std\fR is boolean, equivalent to the \fB\-std\fR option. | |
181 | .Sp | |
182 | \&\fB[@modules]\fR is an array ref, same as additional arguments mentioned above. | |
183 | .IP "Examples" 4 | |
184 | .IX Item "Examples" | |
185 | .Vb 1 | |
186 | \& perl -MExtUtils::Embed -e xsinit -- -o xsinit.c Socket | |
187 | .Ve | |
188 | .Sp | |
189 | This will generate code with an \fBxs_init\fR function that glues the perl \fBSocket::bootstrap\fR function | |
190 | to the C \fBboot_Socket\fR function and writes it to a file named \fIxsinit.c\fR. | |
191 | .Sp | |
192 | Note that \fBDynaLoader\fR is a special case where it must call \fBboot_DynaLoader\fR directly. | |
193 | .Sp | |
194 | .Vb 1 | |
195 | \& perl -MExtUtils::Embed -e xsinit | |
196 | .Ve | |
197 | .Sp | |
198 | This will generate code for linking with \fBDynaLoader\fR and | |
199 | each static extension found in \fB$Config{static_ext}\fR. | |
200 | The code is written to the default file name \fBperlxsi.c\fR. | |
201 | .Sp | |
202 | .Vb 1 | |
203 | \& perl -MExtUtils::Embed -e xsinit -- -o xsinit.c -std DBI DBD::Oracle | |
204 | .Ve | |
205 | .Sp | |
206 | Here, code is written for all the currently linked extensions along with code | |
207 | for \fB\s-1DBI\s0\fR and \fBDBD::Oracle\fR. | |
208 | .Sp | |
209 | If you have a working \fBDynaLoader\fR then there is rarely any need to statically link in any | |
210 | other extensions. | |
211 | .IP "\fIldopts()\fR" 4 | |
212 | .IX Item "ldopts()" | |
213 | Output arguments for linking the Perl library and extensions to your | |
214 | application. | |
215 | .Sp | |
216 | When invoked as \f(CW`perl \-MExtUtils::Embed \-e ldopts \-\-`\fR | |
217 | the following options are recognized: | |
218 | .Sp | |
219 | \&\fB\-std\fR | |
220 | .Sp | |
221 | Output arguments for linking the Perl library and any extensions linked | |
222 | with the current Perl. | |
223 | .Sp | |
224 | \&\fB\-I\fR <path1:path2> | |
225 | .Sp | |
226 | Search path for ModuleName.a archives. | |
227 | Default path is \fB@INC\fR. | |
228 | Library archives are expected to be found as | |
229 | \&\fB/some/path/auto/ModuleName/ModuleName.a\fR | |
230 | For example, when looking for \fBSocket.a\fR relative to a search path, | |
231 | we should find \fBauto/Socket/Socket.a\fR | |
232 | .Sp | |
233 | When looking for \fBDBD::Oracle\fR relative to a search path, | |
234 | we should find \fBauto/DBD/Oracle/Oracle.a\fR | |
235 | .Sp | |
236 | Keep in mind that you can always supply \fB/my/own/path/ModuleName.a\fR | |
237 | as an additional linker argument. | |
238 | .Sp | |
239 | \&\fB\-\-\fR <list of linker args> | |
240 | .Sp | |
241 | Additional linker arguments to be considered. | |
242 | .Sp | |
243 | Any additional arguments found before the \fB\-\-\fR token | |
244 | are expected to be names of modules to generate code for. | |
245 | .Sp | |
246 | When invoked with parameters the following are accepted and optional: | |
247 | .Sp | |
248 | \&\f(CW\*(C`ldopts($std,[@modules],[@link_args],$path)\*(C'\fR | |
249 | .Sp | |
250 | Where: | |
251 | .Sp | |
252 | \&\fB$std\fR is boolean, equivalent to the \fB\-std\fR option. | |
253 | .Sp | |
254 | \&\fB[@modules]\fR is equivalent to additional arguments found before the \fB\-\-\fR token. | |
255 | .Sp | |
256 | \&\fB[@link_args]\fR is equivalent to arguments found after the \fB\-\-\fR token. | |
257 | .Sp | |
258 | \&\fB$path\fR is equivalent to the \fB\-I\fR option. | |
259 | .Sp | |
260 | In addition, when ldopts is called with parameters, it will return the argument string | |
261 | rather than print it to \s-1STDOUT\s0. | |
262 | .IP "Examples" 4 | |
263 | .IX Item "Examples" | |
264 | .Vb 1 | |
265 | \& perl -MExtUtils::Embed -e ldopts | |
266 | .Ve | |
267 | .Sp | |
268 | This will print arguments for linking with \fBlibperl.a\fR, \fBDynaLoader\fR and | |
269 | extensions found in \fB$Config{static_ext}\fR. This includes libraries | |
270 | found in \fB$Config{libs}\fR and the first ModuleName.a library | |
271 | for each extension that is found by searching \fB@INC\fR or the path | |
272 | specified by the \fB\-I\fR option. | |
273 | In addition, when ModuleName.a is found, additional linker arguments | |
274 | are picked up from the \fBextralibs.ld\fR file in the same directory. | |
275 | .Sp | |
276 | .Vb 1 | |
277 | \& perl -MExtUtils::Embed -e ldopts -- -std Socket | |
278 | .Ve | |
279 | .Sp | |
280 | This will do the same as the above example, along with printing additional arguments for linking with the \fBSocket\fR extension. | |
281 | .Sp | |
282 | .Vb 1 | |
283 | \& perl -MExtUtils::Embed -e ldopts -- DynaLoader | |
284 | .Ve | |
285 | .Sp | |
286 | This will print arguments for linking with just the \fBDynaLoader\fR extension | |
287 | and \fBlibperl.a\fR. | |
288 | .Sp | |
289 | .Vb 1 | |
290 | \& perl -MExtUtils::Embed -e ldopts -- -std Msql -- -L/usr/msql/lib -lmsql | |
291 | .Ve | |
292 | .Sp | |
293 | Any arguments after the second '\-\-' token are additional linker | |
294 | arguments that will be examined for potential conflict. If there is no | |
295 | conflict, the additional arguments will be part of the output. | |
296 | .IP "\fIperl_inc()\fR" 4 | |
297 | .IX Item "perl_inc()" | |
298 | For including perl header files this function simply prints: | |
299 | .Sp | |
300 | .Vb 1 | |
301 | \& -I$Config{archlibexp}/CORE | |
302 | .Ve | |
303 | .Sp | |
304 | So, rather than having to say: | |
305 | .Sp | |
306 | .Vb 1 | |
307 | \& perl -MConfig -e 'print "-I$Config{archlibexp}/CORE"' | |
308 | .Ve | |
309 | .Sp | |
310 | Just say: | |
311 | .Sp | |
312 | .Vb 1 | |
313 | \& perl -MExtUtils::Embed -e perl_inc | |
314 | .Ve | |
315 | .IP "\fIccflags()\fR, \fIccdlflags()\fR" 4 | |
316 | .IX Item "ccflags(), ccdlflags()" | |
317 | These functions simply print \f(CW$Config\fR{ccflags} and \f(CW$Config\fR{ccdlflags} | |
318 | .IP "\fIccopts()\fR" 4 | |
319 | .IX Item "ccopts()" | |
320 | This function combines \fIperl_inc()\fR, \fIccflags()\fR and \fIccdlflags()\fR into one. | |
321 | .IP "\fIxsi_header()\fR" 4 | |
322 | .IX Item "xsi_header()" | |
323 | This function simply returns a string defining the same \fB\s-1EXTERN_C\s0\fR macro as | |
324 | \&\fBperlmain.c\fR along with #including \fBperl.h\fR and \fB\s-1EXTERN\s0.h\fR. | |
325 | .IP "xsi_protos(@modules)" 4 | |
326 | .IX Item "xsi_protos(@modules)" | |
327 | This function returns a string of \fBboot_$ModuleName\fR prototypes for each \f(CW@modules\fR. | |
328 | .IP "xsi_body(@modules)" 4 | |
329 | .IX Item "xsi_body(@modules)" | |
330 | This function returns a string of calls to \fB\f(BInewXS()\fB\fR that glue the module \fBbootstrap\fR | |
331 | function to \fBboot_ModuleName\fR for each \f(CW@modules\fR. | |
332 | .Sp | |
333 | \&\fB\f(BIxsinit()\fB\fR uses the xsi_* functions to generate most of its code. | |
334 | .SH "EXAMPLES" | |
335 | .IX Header "EXAMPLES" | |
336 | For examples on how to use \fBExtUtils::Embed\fR for building C/\*(C+ applications | |
337 | with embedded perl, see perlembed. | |
338 | .SH "SEE ALSO" | |
339 | .IX Header "SEE ALSO" | |
340 | perlembed | |
341 | .SH "AUTHOR" | |
342 | .IX Header "AUTHOR" | |
343 | Doug MacEachern <\fIdougm@osf.org\fR> | |
344 | .PP | |
345 | Based on ideas from Tim Bunce <\fITim.Bunce@ig.co.uk\fR> and | |
346 | \&\fBminimod.pl\fR by Andreas Koenig <\fIk@anna.in\-berlin.de\fR> and Tim Bunce. |