Hi all,

I need to embed perl (5.6.0) functions (from the file parse_tds.pl) into a C application (called interp.c) but I have compile error. From my C code I call a perl function which uses 3 external modules Data, Spreadsheet and Getopt. I have already installed those modules before. Linux is the working environment.
First I generated xsinit.c file by:


perl -MExtUtils::Embed -e xsinit -- -o xsinit.c -std Data Spreadsheet +Getopt


then compiling and linking everything by:

cc -c xsinit.c `perl -MExtUtils::Embed -e ccopts` cc -c interp.c `perl -MExtUtils::Embed -e ccopts` cc -o interp interp.o xsinit.o `perl -MExtUtils::Embed -e ldopts`

but the last command returns the following error:

cc -o interp interp.o xsinit.o `perl -MExtUtils::Embed -e ldopts` xsinit.o: In function `xs_init': xsinit.o(.text+0x14): undefined reference to `boot_Data' xsinit.o(.text+0x2c): undefined reference to `boot_Spreadsheet' xsinit.o(.text+0x44): undefined reference to `boot_Getopt' collect2: ld returned 1 exit status
It seems to me that I would need to link xsinit.o with archive Data.a Spreadsheet.a and Getopt.a but I don't have such files anywhere like could be for Socket.a !!!!!
What can I do ? Is there a way to generate .a files from those modules ?

Many thanks,
Luke


In reply to (duplicate) Embed Perl into C...compile error !!! by vbn99_luke

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.