On Wed Sep 12 14:09:52 2007, AVAR wrote:
Show quoted text> I wrote some simple Inline::C code in a script and compiled it with
> 5.8.8, this generated an _Inline directory. I then ran the script with
> perl 5.9.5 which caused a segfault. It seems that Inline::C (and
> probably Inline in general) does not check whether the version that's
> loading the .so is the version that compiled it. Obviously this is a
big
Show quoted text> problem.
Inline already provides you with the means to deal with this. You can
start your scripts with:
------------------
BEGIN {
use Config;
mkdir "my_$]" unless -d "my_$]";
};
use Inline C => Config =>
DIRECTORY => "./my_$]";
.
.
------------------
Then, when you run that script using perl-5.8.8 it will
use 'my_5008008' as the Inline directory. If you then subsequently run
the same script (in the same location) using perl-5.9.5, then the
Inline directory becomes 'my_5009005', and the script will be re-
compiled - and all will be well.
But, say you have 2 versions of perl-5.8.8 that have been built with
different (incompatible) config options - eg one version built with
multi-threading, the other version without. Then you'll still strike
the same problem. To work around this additional issue you could begin
your scripts with:
------------------
BEGIN {
use Config;
mkdir "$Config{archname}-$]" unless -d "$Config{archname}-$]";
};
use Inline C => Config =>
DIRECTORY => "./$Config{archname}-$]";
.
.
------------------
Admittedly, Inline could be amended to take care of all that for the
user. Should it be ? I'm a little undecided ...
Cheers,
Rob