How can I use a C++ class from Perl?
I have a set of classes written in C++. What would be best way to call them from a Perl script? Thanks. ...
I have a set of classes written in C++. What would be best way to call them from a Perl script? Thanks. ...
I writing programing with Perl and XS. I need to display and do some operations that use a linked list from C. How can I accomplish that? ...
In XS, how do I turn a string that holds a variable name into its address, I want to do something like the following perl code: our $var = 1; print ${$main::{var}}; ...
I'm working on a Perl module and whenever I call the skip() method I wrote in the following way: $cursor->skip(4); I get: Undefined subroutine Perl finds it! Oddly, if I name "skip" anything else ("skipper", "hello"), this syntax works: $cursor->skipper(4); I thought maybe skip() was a "secret" reserved key word or somethi...
How can I pass Perl array by reference to C XS module? my @array = ( 1..20 ); XSTEST::test_array_passing(\@array); What do I do in XS so it sees the array? ...
EDIT: I have created a ticket for this which has data on an alternative to this way of doing things. I have updated the code in an attempt to use MY_CXT's callback as gcxt was not storing across threads. However this segfaults at ENTER. #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #ifndef aTHX_ #define aTHX_ #endif #ifdef...
Both perlcall (in the "Strategies for storing Callback Context Information" section) and Extending and Embedding Perl (in the "Callback" section) lists 3 different ways to handle calling Perl sub routines from XS/C: Immediately: XS calls Deferred: saving the sub ref as an SV* for later Multiple: save n sub refs for later The example...
I have gone through the source code of Data::Dumper. In this package I didn't understand what's going on with DumpXS. What is the use of this DumpXS? I have searched about this and I read that, it is equal to the Dump function and it is faster than Dump. But I didn't understand it. ...
I have a module that will target several different operating systems and configurations. Sometimes, some C code can make this module's task a little easier, so I have some C functions that I would like to bind the code. I don't have to bind the C functions -- I can't guarantee that the end-user even has a C compiler, for instance, and it...
This has been working for me in 5.8 and 5.10, but in 5.12 my code creates this weird non-qr object: # running "print Dumper($regex)" $VAR1 = bless( do{\(my $o = '')}, 'Regexp' ); Whereas printing a qr// not created by my code looks like this: # running "print Dumper(qr/foo/i)" $VAR1 = qr/(?i-xsm:foo)/; My code is basically: REGEXP...
I have written a Perl XS wrapper for a C library consisting of about ~80 functions. Right now my general strategy is to substitute the error from a C function with PL_sv_undef and the calling Perl code has to check explicitly whether the return is not undef. (For some C functions it is more complicated as I convert their output into a HV...
It seems some (many?) modules on CPAN are partly implemented in C using XS, and can fall back to a pure-perl implementation if necessary. While this is smart, it can obviously hurt performance, and I would like to know it happens so I can fix the problem. Is there a general way of stopping or detecting this type of fallback? For an exa...
I'm just going through perlxstut and I found there newSVnv in EXAMPLE 5 and EXAMPLE 6 but I think that newSVuv should be more appropriate. Curiously newSVnv works too. What's going on? ...
I wish to embed a C code in Perl. In this C code I want to read a huge file into memory, make some changes and build a hash (a custom one). I wish to make this hash accessible from my Perl code. Is it possible? How can I reach the goal? ...
A lot of sample Scala code contains Strings and Collections named "xs" Why xs? Anything to do with the xs: used in XML (for Schema?) Examples: var xs = List(1,2,3) val xs = "abc" ...