Hi, i'm getting into perl and xs, little example work fine, what i'm trying to do is use the festival api in perl, but the program go in segmentation fault every time i run it. Here follow some code, sure someone else can find some mistake that i didn't see :) The xs file...
...... #include <festival/festival.h> MODULE = festival_test PACKAGE = festival_test void initialize(load_init_file,heap_size) int load_init_file int heap_size CODE: festival_initialize(load_init_file,heap_size); .......
The Makefile.PL
$CC='g++'; WriteMakefile( NAME => 'festival_test', VERSION_FROM => 'lib/festival_test.pm', # finds $VERSION PREREQ_PM => {}, ($] >= 5.005 ? (ABSTRACT_FROM => 'lib/festival_test.pm', AUTHOR => 'A. U. Thor <spike@(none)>') : ()), LIBS => ['-L/usr/lib -lFestival -lestools -lestbase - +leststring -lncurses '], DEFINE => '', INC => '-I. -I/usr/include/speech-tools/', 'CC' => $CC, 'LD' => '$(CC)', );
Two line of perl to use this...
use ExtUtils::testlib; use festival_test; print "\nWrite something you want to be read from me: "; $txt=<>; festival_test::initialize(1,210000);
The segmentation fault come on the initialize call, using perl -d, it just freeze. Suggestions, corrections?, thanks

In reply to Segfault when using Festival library from XS by raf

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.