If you're having trouble with the basic functionality, I would recommend that you get that basic functionality of your code sorted out and tested in an Inline::C script before you even write SDR::RTLSDR.
That's an approach that has always worked quite well for me.
It also means that you can provide a script that shows everything you're trying to do.
It's pretty hard to work out exactly what you're doing from a few snippets.
I assume your module will link to the librtlsdr library, and I'm wondering why your XS code appears to be creating/declaring its own rtlsdr_open() when that function is already (presumably) provided by that library and the librtlsdr header.
Anyway, for an Inline::C script, you'd want something like:
use strict;
use warnings;
use Inline C => Config =>
#CLEAN_AFTER_BUILD => 0, #
BUILD_NOISY => 1, # display the compilation
inc => '-I/path/to/librtlsdr_headers',
libs => '-L/path/to/librtsldr_library,
;
use Inline C => <<'EOC';
#include<librtlsdr_header.h>
void foo(<args>) {
/* do something that uses librtlsdr
and print out a success/fail message */
}
void bar(<args>) {
/* do something else that uses librtlsdr
and print out a success/fail message */
}
EOC
foo();
bar();
Add more functionality and complexity as you get things working.
Inline::C provides typemapping and just about everything else that XS provides. (See the Inline::C documentation and cookbook.)
In the code section, you're essentially just writing C code - but perl API functions can also be used.
Inline::C works by first creating an XS file, which you can find in the ./_Inline directory if you include
CLEAN_AFTER_BUILD in the Config section of the script before building.
Cheers,
Rob
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.