Hi Rob,

Here's the code I mentioned in my previous post. The 'add' function works properly if I execute it, whereas calling 'doSSW' results in a "Undefined subroutine" error. Thus my guess is that the issue lies with passing Perl strings to a C++ function.

Best, René
#!/usr/bin/perl use warnings; use Inline CPP => Config => BUILD_NOISY => 1, CLEAN_AFTER_BUILD => 0; use Inline CPP => Config => AUTO_INCLUDE => '#include "ssw_cpp.h"'; use Inline CPP; my $ref = "CAGCCTTTCTGACCCGGAAATCAAAATAGGCACAACAAA"; my $seq = "CTGAGCCGGTAAATC"; print add(3,5)."\n"; my $returned = cprintit($seq); print $returned."\n"; #my $cigar = do_SSW($seq,$ref); #print "$cigar\n"; __END__ __CPP__ using namespace std; string do_SSW(const char* queryC, const char* refC) { Inline_Stack_Vars; string query(queryC); string ref(refC); StripedSmithWaterman::Aligner aligner; StripedSmithWaterman::Filter filter; StripedSmithWaterman::Alignment alignment; aligner.Align(query.c_str(), ref.c_str(), ref.size(), filter, &ali +gnment); return alignment.cigar_string; } int add (const int a, const int b) { int c = a+b; return c; } int cprintit(const string seq) { cout << seq << endl; return 10; }

In reply to Re^4: Including existing C or CPP library using Inline by bontus
in thread Including existing C or CPP library using Inline by bontus

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.