assertions are your friend.

If you pass -DNDEBUG into C-compiler at C-compile-time, the assertions will not be compiled. However, except for your inner-number-crunching loops I'd suggest leaving them on.

once you get an assertion to core dump, assuming you have compiled with debugging on, I believe (haven't actually done it though ...) that you can fire up gdb with the core file and at hopefully get a pretty good idea of the state of things with just up,down, and print.

If things get hairy enough so that the above still doesn't cut it, I think what you want to do is try to make the actual C code that appears in the Inline:: part as small as possible, making it just Interface code to a library. Then make a separate C 'client' for the same library and do all your C debugging in a normal C way. If problems persist then you can be pretty sure its an interface problem.

I'm reinventing this particular wheel slowly at home (The neural net wheel... not the Inline::C wheel). Out of curiosity, how much is done in C and how much in perl? Based on a purely anecdotal analysis (i.e. I've been too lazy to profile it) I think the matrix-vector multiplication and multiplication by the transpose is about the only part that really needs to be done in C.

In reply to Re: Testing Inline::C Modules by chance
in thread Testing Inline::C Modules by Ovid

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.