I think it works the same

You and BrowserUK may well be right - so I thought I'd make use of the snippett BrowserUk provided and change 'power.pl' in the above example to:
use Win32::API; sub expo { my $function = Win32::API->new( 'power.exe, 'int foo()', ); $return = $function->Call(); print "foo returned $return\n"; my ($a, $b) = @_; return $a ** $b; }
I realise that foo() may not be exported by my 'power.exe', but thought I might as well give it a try. The output of running 'power.exe' now changes to:
C:\_32\pscrpt\embed>power Can't load module Win32::API, dynamic loading not available in this pe +rl. (You may need to build a new perl executable which either supports dynamic loading or has the Win32::API module statically linked into +it.) at power.pl line 1 Compilation failed in require at power.pl line 1. BEGIN failed--compilation aborted at power.pl line 1. Undefined subroutine &main::expo called at power.pl line 1.
I don't normally have any such trouble with Win32::API, so I presume the message is telling me that the embedded perl interpreter is a static one - and I'll either have to link Win32::API statically to it, or embed an interpreter that supports dynamic loading.

Without knowing what's entailed, it doesn't sound particularly trivial to achieve, and I'm not sure that I really want to pursue it
:-)

Cheers,
Rob

In reply to Re^8: perl c++ perlembed question by syphilis
in thread perl c++ perlembed question by eth0nic

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.