home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / perl5 / ExtUtils::Embed.z / ExtUtils::Embed
Encoding:
Text File  |  1998-10-30  |  12.7 KB  |  331 lines

  1.  
  2.  
  3.  
  4. EEEExxxxttttUUUUttttiiiillllssss::::::::EEEEmmmmbbbbeeeedddd((((3333))))                                          EEEExxxxttttUUUUttttiiiillllssss::::::::EEEEmmmmbbbbeeeedddd((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      ExtUtils::Embed - Utilities for embedding Perl in C/C++ applications
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.       perl -MExtUtils::Embed -e xsinit
  13.       perl -MExtUtils::Embed -e ldopts
  14.  
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      ExtUtils::Embed provides utility functions for embedding a Perl
  18.      interpreter and extensions in your C/C++ applications. Typically, an
  19.      application MMMMaaaakkkkeeeeffffiiiilllleeee will invoke ExtUtils::Embed functions while building
  20.      your application.
  21.  
  22. @@@@EEEEXXXXPPPPOOOORRRRTTTT
  23.      ExtUtils::Embed exports the following functions:
  24.  
  25.      _x_s_i_n_i_t(), _l_d_o_p_t_s(), _c_c_o_p_t_s(), _p_e_r_l__i_n_c(), _c_c_f_l_a_g_s(), _c_c_d_l_f_l_a_g_s(),
  26.      _x_s_i__h_e_a_d_e_r(), _x_s_i__p_r_o_t_o_s(), _x_s_i__b_o_d_y()
  27.  
  28. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS
  29.      xsinit()
  30.           Generate C/C++ code for the XS initializer function.
  31.  
  32.           When invoked as `perl -MExtUtils::Embed -e xsinit --` the following
  33.           options are recognized:
  34.  
  35.           ----oooo <output filename> (Defaults to ppppeeeerrrrllllxxxxssssiiii....cccc)
  36.  
  37.           ----oooo SSSSTTTTDDDDOOOOUUUUTTTT will print to STDOUT.
  38.  
  39.           ----ssssttttdddd (Write code for extensions that are linked with the current
  40.           Perl.)
  41.  
  42.           Any additional arguments are expected to be names of modules to
  43.           generate code for.
  44.  
  45.           When invoked with parameters the following are accepted and
  46.           optional:
  47.  
  48.           xsinit($filename,$std,[@modules])
  49.  
  50.           Where,
  51.  
  52.           $$$$ffffiiiilllleeeennnnaaaammmmeeee is equivalent to the ----oooo option.
  53.  
  54.           $$$$ssssttttdddd is boolean, equivalent to the ----ssssttttdddd option.
  55.  
  56.           [[[[@@@@mmmmoooodddduuuulllleeeessss]]]] is an array ref, same as additional arguments mentioned
  57.           above.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. EEEExxxxttttUUUUttttiiiillllssss::::::::EEEEmmmmbbbbeeeedddd((((3333))))                                          EEEExxxxttttUUUUttttiiiillllssss::::::::EEEEmmmmbbbbeeeedddd((((3333))))
  71.  
  72.  
  73.  
  74.      Examples
  75.  
  76.            perl -MExtUtils::Embed -e xsinit -- -o xsinit.c Socket
  77.  
  78.           This will generate code with an xxxxssss____iiiinnnniiiitttt function that glues the perl
  79.           SSSSoooocccckkkkeeeetttt::::::::bbbboooooooottttssssttttrrrraaaapppp function to the C bbbbooooooootttt____SSSSoooocccckkkkeeeetttt function and writes
  80.           it to a file named "xsinit.c".
  81.  
  82.           Note that DDDDyyyynnnnaaaaLLLLooooaaaaddddeeeerrrr is a special case where it must call
  83.           bbbbooooooootttt____DDDDyyyynnnnaaaaLLLLooooaaaaddddeeeerrrr directly.
  84.  
  85.            perl -MExtUtils::Embed -e xsinit
  86.  
  87.           This will generate code for linking with DDDDyyyynnnnaaaaLLLLooooaaaaddddeeeerrrr and each static
  88.           extension found in $$$$CCCCoooonnnnffffiiiigggg{{{{ssssttttaaaattttiiiicccc____eeeexxxxtttt}}}}.  The code is written to the
  89.           default file name ppppeeeerrrrllllxxxxssssiiii....cccc.
  90.  
  91.            perl -MExtUtils::Embed -e xsinit -- -o xsinit.c -std DBI DBD::Oracle
  92.  
  93.           Here, code is written for all the currently linked extensions along
  94.           with code for DDDDBBBBIIII and DDDDBBBBDDDD::::::::OOOOrrrraaaacccclllleeee.
  95.  
  96.           If you have a working DDDDyyyynnnnaaaaLLLLooooaaaaddddeeeerrrr then there is rarely any need to
  97.           statically link in any other extensions.
  98.  
  99.      ldopts()
  100.           Output arguments for linking the Perl library and extensions to your
  101.           application.
  102.  
  103.           When invoked as `perl -MExtUtils::Embed -e ldopts --` the following
  104.           options are recognized:
  105.  
  106.           ----ssssttttdddd
  107.  
  108.           Output arguments for linking the Perl library and any extensions
  109.           linked with the current Perl.
  110.  
  111.           ----IIII <path1:path2>
  112.  
  113.           Search path for ModuleName.a archives. Default path is @@@@IIIINNNNCCCC.
  114.           Library archives are expected to be found as
  115.           ////ssssoooommmmeeee////ppppaaaatttthhhh////aaaauuuuttttoooo////MMMMoooodddduuuulllleeeeNNNNaaaammmmeeee////MMMMoooodddduuuulllleeeeNNNNaaaammmmeeee....aaaa For example, when looking
  116.           for SSSSoooocccckkkkeeeetttt....aaaa relative to a search path, we should find
  117.           aaaauuuuttttoooo////SSSSoooocccckkkkeeeetttt////SSSSoooocccckkkkeeeetttt....aaaa
  118.  
  119.           When looking for DDDDBBBBDDDD::::::::OOOOrrrraaaacccclllleeee relative to a search path, we should
  120.           find aaaauuuuttttoooo////DDDDBBBBDDDD////OOOOrrrraaaacccclllleeee////OOOOrrrraaaacccclllleeee....aaaa
  121.  
  122.           Keep in mind, you can always supply ////mmmmyyyy////oooowwwwnnnn////ppppaaaatttthhhh////MMMMoooodddduuuulllleeeeNNNNaaaammmmeeee....aaaa as an
  123.           additional linker argument.
  124.  
  125.           --------  <list of linker args>
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. EEEExxxxttttUUUUttttiiiillllssss::::::::EEEEmmmmbbbbeeeedddd((((3333))))                                          EEEExxxxttttUUUUttttiiiillllssss::::::::EEEEmmmmbbbbeeeedddd((((3333))))
  137.  
  138.  
  139.  
  140.           Additional linker arguments to be considered.
  141.  
  142.           Any additional arguments found before the -------- token are expected to
  143.           be names of modules to generate code for.
  144.  
  145.           When invoked with parameters the following are accepted and
  146.           optional:
  147.  
  148.           ldopts($std,[@modules],[@link_args],$path)
  149.  
  150.           Where,
  151.  
  152.           $$$$ssssttttdddd is boolean, equivalent to the ----ssssttttdddd option.
  153.  
  154.           [[[[@@@@mmmmoooodddduuuulllleeeessss]]]] is equivalent to additional arguments found before the --------
  155.           token.
  156.  
  157.           [[[[@@@@lllliiiinnnnkkkk____aaaarrrrggggssss]]]] is equivalent to arguments found after the -------- token.
  158.  
  159.           $$$$ppppaaaatttthhhh is equivalent to the ----IIII option.
  160.  
  161.           In addition, when ldopts is called with parameters, it will return
  162.           the argument string rather than print it to STDOUT.
  163.  
  164.      Examples
  165.  
  166.            perl -MExtUtils::Embed -e ldopts
  167.  
  168.           This will print arguments for linking with lllliiiibbbbppppeeeerrrrllll....aaaa, DDDDyyyynnnnaaaaLLLLooooaaaaddddeeeerrrr and
  169.           extensions found in $$$$CCCCoooonnnnffffiiiigggg{{{{ssssttttaaaattttiiiicccc____eeeexxxxtttt}}}}.  This includes libraries
  170.           found in $$$$CCCCoooonnnnffffiiiigggg{{{{lllliiiibbbbssss}}}} and the first ModuleName.a library for each
  171.           extension that is found by searching @@@@IIIINNNNCCCC or the path specifed by
  172.           the ----IIII option. In addition, when ModuleName.a is found, additional
  173.           linker arguments are picked up from the eeeexxxxttttrrrraaaalllliiiibbbbssss....lllldddd file in the
  174.           same directory.
  175.  
  176.            perl -MExtUtils::Embed -e ldopts -- -std Socket
  177.  
  178.           This will do the same as the above example, along with printing
  179.           additional arguments for linking with the SSSSoooocccckkkkeeeetttt extension.
  180.  
  181.            perl -MExtUtils::Embed -e ldopts -- DynaLoader
  182.  
  183.           This will print arguments for linking with just the DDDDyyyynnnnaaaaLLLLooooaaaaddddeeeerrrr
  184.           extension and lllliiiibbbbppppeeeerrrrllll....aaaa.
  185.  
  186.            perl -MExtUtils::Embed -e ldopts -- -std Msql -- -L/usr/msql/lib -lmsql
  187.  
  188.           Any arguments after the second '--' token are additional linker
  189.           arguments that will be examined for potential conflict.  If there is
  190.           no conflict, the additional arguments will be part of the output.
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. EEEExxxxttttUUUUttttiiiillllssss::::::::EEEEmmmmbbbbeeeedddd((((3333))))                                          EEEExxxxttttUUUUttttiiiillllssss::::::::EEEEmmmmbbbbeeeedddd((((3333))))
  203.  
  204.  
  205.  
  206.      perl_inc()
  207.           For including perl header files this function simply prints:
  208.  
  209.            -I$Config{archlibexp}/CORE
  210.  
  211.           So, rather than having to say:
  212.  
  213.            perl -MConfig -e 'print "-I$Config{archlibexp}/CORE"'
  214.  
  215.           Just say:
  216.  
  217.            perl -MExtUtils::Embed -e perl_inc
  218.  
  219.  
  220.      ccflags(), ccdlflags()
  221.           These functions simply print $Config{ccflags} and $Config{ccdlflags}
  222.  
  223.      ccopts()
  224.           This function combines _p_e_r_l__i_n_c(), _c_c_f_l_a_g_s() and _c_c_d_l_f_l_a_g_s() into
  225.           one.
  226.  
  227.      xsi_header()
  228.           This function simply returns a string defining the same EEEEXXXXTTTTEEEERRRRNNNN____CCCC
  229.           macro as ppppeeeerrrrllllmmmmaaaaiiiinnnn....cccc along with #including ppppeeeerrrrllll....hhhh and EEEEXXXXTTTTEEEERRRRNNNN....hhhh.
  230.  
  231.      xsi_protos(@modules)
  232.           This function returns a string of bbbbooooooootttt____$$$$MMMMoooodddduuuulllleeeeNNNNaaaammmmeeee prototypes for
  233.           each @modules.
  234.  
  235.      xsi_body(@modules)
  236.           This function returns a string of calls to nnnneeeewwwwXXXXSSSS(((()))) that glue the
  237.           module bbbboooooooottttssssttttrrrraaaapppp function to bbbbooooooootttt____MMMMoooodddduuuulllleeeeNNNNaaaammmmeeee for each @modules.
  238.  
  239.           xxxxssssiiiinnnniiiitttt(((()))) uses the xsi_* functions to generate most of it's code.
  240.  
  241. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  242.      For examples on how to use EEEExxxxttttUUUUttttiiiillllssss::::::::EEEEmmmmbbbbeeeedddd for building C/C++
  243.      applications with embedded perl, see the eg/ directory and the _p_e_r_l_e_m_b_e_d
  244.      manpage.
  245.  
  246. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  247.      the _p_e_r_l_e_m_b_e_d manpage
  248.  
  249. AAAAUUUUTTTTHHHHOOOORRRR
  250.      Doug MacEachern <_d_o_u_g_m@_o_s_f._o_r_g>
  251.  
  252.      Based on ideas from Tim Bunce <_T_i_m._B_u_n_c_e@_i_g._c_o._u_k> and mmmmiiiinnnniiiimmmmoooodddd....ppppllll by
  253.      Andreas Koenig <_k@_a_n_n_a._i_n-_b_e_r_l_i_n._d_e> and Tim Bunce.
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. EEEExxxxttttUUUUttttiiiillllssss::::::::EEEEmmmmbbbbeeeedddd((((3333))))                                          EEEExxxxttttUUUUttttiiiillllssss::::::::EEEEmmmmbbbbeeeedddd((((3333))))
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.                                                                         PPPPaaaaggggeeee 5555
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.