As the error message said, perl is trying to dynamically load IO.so at runtime and it can't, most likely because of the way you built perl into your C++ application.

If you can't adjust the linker options for your C++ application so that it (and the embedded perl) supports loading on dynamic modules, then your alternative is to adjust your Makefile to statically include the IO related library into your application. You might find that when IO::Socket was installed it built IO.o as well as IO.so, which you can directly link in. If not you will need to include the IO::Socket source tree into your tree, and modify the makefile to build a statically linkable library. This approach will only work if you know in advance which binary modules your script needs. Also if you statically link IO::Socket into your application and distribute it, you will need to respect the licence (same as perl) of IO::Socket, and any conditions it imposes on your entire application.

A third option would be to not use the IO::Socket module and do your socket programming by hand. All the raw socket functions are documented in perlfunc, though they are rather low level, and convoluted to use.

Also, if you do cross post questions in other forums, please say so, and link to the other forum. We don't mind if you cross post, but when we answer questions we usually read what has been said already, as it is annoying to repeat someone else's answer. If you cross post without telling us then we don't know to read the other forum to see if our answer has already been posted.


In reply to Re: Embed Perl in C++ (C in perl in C) by chrestomanci
in thread Embed Perl in C++ (C in perl in C) by suryakiran

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.