Ok, that worked:

./svpv.pl Starting Build Preprocess Stage + + + Finished Build Preprocess Stage + + + + + + Starting Build Parse Stage Finished Build Parse Stage Starting Build Glue 1 Stage Finished Build Glue 1 Stage Starting Build Glue 2 Stage Finished Build Glue 2 Stage Starting Build Glue 3 Stage Finished Build Glue 3 Stage Starting Build Compile Stage Starting "perl Makefile.PL" Stage Writing Makefile for _967160 Writing MYMETA.yml Finished "perl Makefile.PL" Stage Starting "make" Stage /usr/bin/perl /usr/lib/perl5/5.14.2/ExtUtils/xsubpp -typemap /usr/lib +/perl5/5.14.2/ExtUtils/typemap _967160.xs > _967160.xsc && mv _9671 +60.xsc _967160.c cc -c -I/home/kadler -D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTEN +V -fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D +_FILE_OFFSET_BITS=64 -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 + -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -W +all -pipe -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\" -fPIC "-I/usr/li +b/perl5/5.14.2/x86_64-linux-thread-multi/CORE" _967160.c Running Mkbootstrap for _967160 () chmod 644 _967160.bs rm -f blib/arch/auto/_967160/_967160.so cc -shared -L/usr/local/lib64 -fstack-protector _967160.o -o blib/ar +ch/auto/_967160/_967160.so \ \ chmod 755 blib/arch/auto/_967160/_967160.so cp _967160.bs blib/arch/auto/_967160/_967160.bs chmod 644 blib/arch/auto/_967160/_967160.bs Finished "make" Stage Starting "make install" Stage Files found in blib/arch: installing files in blib/lib into architectu +re dependent library tree Installing /home/kadler/_Inline/lib/auto/_967160/_967160.bs Installing /home/kadler/_Inline/lib/auto/_967160/_967160.so Finished "make install" Stage Starting Cleaning Up Stage Finished Cleaning Up Stage Finished Build Compile Stage fred 1

But, I wasn't actually using Inline::C. Just using that as an example of using SvPV and SvPV_nolen to build my XS module. There must be something wrong with building my XS module, then.

I've been using perlxstut as a basis, specifically examples #4 and #5.

Here's mylib.c:
#include <stdlib.h> #include "mylib.h" PerlInterpreter *my_perl; void foo(SV * sv) { if(sv) { printf("%s\n", SvPV_nolen(sv)); } } void bar(SV * sv) { printf ("%i\n", SvPOK(sv)); }
Here's mylib.h:
#include "EXTERN.h" #include "perl.h" #define TESTVAL 4 void foo(SV * sv); void bar(SV * sv);
Here's Mytest2.xs:
#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" #include "mylib/mylib.h" #include "const-c.inc" MODULE = Mytest2 PACKAGE = Mytest2 INCLUDE: const-xs.inc void foo(SV * sv) void bar(SV * sv)
Everything else should be exactly as in perlxstut.

In reply to Re^2: SvPV Segmentation Fault by adler187
in thread SvPV Segmentation Fault by adler187

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.