Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: help with XS pointers

by Bpl (Scribe)
on Jul 31, 2020 at 12:19 UTC ( [id://11120127]=note: print w/replies, xml ) Need Help??


in reply to Re: help with XS pointers
in thread help with XS pointers

Hi bliako, yes, you're right when assign the NULL value to the $device variable, yesterday I found a similar example from this site: http://sdr.f4gkr.org/trac/browser/gkSDR/Logiciel/rwhw/rtlsdr_iface.cpp?rev=9 which confirm also the idea of the status code (the correct return would be "0"). the initial idea was right but the return code is the same as before:
device name 'Generic RTL2832U OEM' SDR::RTLSDR::rtlsdr_open: dev is not of type RTLSDRDevice_TPtrPtr at s +dr.pl line 13.
Regards Edoardo M.

Replies are listed 'Best First'.
Re^3: help with XS pointers
by bliako (Monsignor) on Jul 31, 2020 at 12:46 UTC

    Does that make sense at all?

    my $device = SDR::RTLSDR->new(); my $status = rtlsdr_open( \$device , $index); print "status $status for index $index\n";

    also see this example perlxstypemap (search for T_PTROBJ_SPECIAL) and the Netconfig example in perlxs

    Does the error message you cited corresponds for the typemap source code you have shown?

      Hi, yes the typemap is the same as before, if I try to change to "T_PTROBJ_SPECIAL" it gives this error:
      Downloads/SDR::RTLSDR/SDR (another copy)/typemap' RTLSDR.xs > RTLSDR. +xsc Can't locate object method "xstype" via package "SDR__RTLSDR *" (perha +ps you forgot to load "SDR__RTLSDR *"?) at /usr/local/share/perl/5.22 +.1/ExtUtils/ParseXS.pm line 1905, <__ANONIO__> line 38. Makefile:359: recipe for target 'RTLSDR.c' failed
      the typemap file now is:
      GNU nano 2.5.3 File: typemap + TYPEMAP SDR::RTLSDR * T_PTROBJ_SPECIAL SDR::RTLSDR ** T_PTROBJ const char * T_PV int * T_PV char * T_PV unsigned long int T_U_LONG uint8_t T_U_SHORT uint8_t * T_U_SHORT uint16_t T_U_SHORT uint32_t * T_U_SHORT uint32_t T_U_SHORT

        Sorry, I did not say that you must copy it, I meant that that's how they associate a C struct with a Perl object.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11120127]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 12:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found