----- Original Message ----- 
From: "Karthika Arunkumar" <[EMAIL PROTECTED]>
To: <inline@perl.org>
Sent: Thursday, October 26, 2006 10:27 AM
Subject: inline c++ in perl.....error in executable ALONE.


> HI all,
> In linux I converted my perl program(inline c++)  to executable with PAR
pp.
> when running my .pl everything is fine.
> But when runnung my executable ./file , it says it cant locate object
method
> new and another function(both written in inline c++)
>
> How do I proceed.some hints plssss...
> thanks a lot.
>
I'm of the view that the best solution is to go that one step further and
convert your Inline CPP script into a perl module. In running your Inline
CPP script, the XS file already gets written. If you run that script with
the Config option CLEAN_AFTER_BUILD=>0 you can then grab that XS file
straight out of the build directory. Then you just need a Makefile.Pl and a
'.pm' and you can build Your::Module in the usual way.

Then, in your script, you simply 'use Your::Module;' instead of doing the
Inline CPP stuff, and pp can then convert that script into a standalone
executable (just like it can do with other scripts that use modules).

I think it's *possible* to 'pp' your Inline::CPP script. Here's a
copy'n'paste of something I wrote in an earlier similar thread. I think it
should apply to Inline::CPP as well as Inline::C, but I haven't tested:

--quote from "Re: PAR and Inline::C - was Re: Is Par dead? Where to
download?"--

The following seems to work for me with a simple Inline::C script:

1) Compile the Inline::C script:
perl test.pl

2) Build the executable:
pp -M FindBin -M Inline -o test.exe test.pl

3) Ship the executable with the entire sub-directory that houses the dll
that Inline::C created when 'perl test.pl' was run. That sub-directory will
be called something like _Inline/lib/auto/nnnn_xx_dddd - where 'nnnn' is the
name of the script ('test' in this example), 'xx' is the extension you gave
to the script ('pl' in this example), and 'dddd' is the first four hex
digits of the MD5 digest that Inline calculated for the script.

Afaict, if that entire directory structure sits alongside test.exe, then it
will work fine.

Now .... perhaps that "directory structure" (and the files contained
therein) can be built into the executable - thus rendering it unnecessary to
distribute that "directory structure" separately with the executable. Can
that be done ? (My understanding of PAR is not all that flash :-)

--end quote

Cheers,

Rob

Reply via email to