xs-fun | XS is fun : a simple and easy tutorial on writing Perl XS | Learning library

 by   xsawyerx C Version: Current License: No License

kandi X-RAY | xs-fun Summary

kandi X-RAY | xs-fun Summary

xs-fun is a C library typically used in Tutorial, Learning applications. xs-fun has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

Any XS guru will tell you XS is easy. I’ve heard this many times. While it may be true, I realized one thing: XS can be scary. The purpose of this guide is to make XS fun. Yes, fun. Try it out, if you won’t feel as exhilarated as I do as you make your way up the stairs of XS knowledge, I will fully reimburse your tuition.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              xs-fun has a low active ecosystem.
              It has 137 star(s) with 37 fork(s). There are 27 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 3 open issues and 6 have been closed. On average issues are closed in 262 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of xs-fun is current.

            kandi-Quality Quality

              xs-fun has no bugs reported.

            kandi-Security Security

              xs-fun has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              xs-fun does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              xs-fun releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of xs-fun
            Get all kandi verified functions for this library.

            xs-fun Key Features

            No Key Features are available at this moment for xs-fun.

            xs-fun Examples and Code Snippets

            No Code Snippets are available at this moment for xs-fun.

            Community Discussions

            QUESTION

            Safely freeing resources in XS code (running destructors on scope exit)
            Asked 2017-Aug-22 at 09:41

            I am writing an XS module. I allocate some resource (e.g. malloc() or SvREFCNT_inc()) then do some operations involving the Perl API, then free the resource. This is fine in normal C because C has no exceptions, but code using the Perl API may croak(), thus preventing normal cleanup and leaking the resources. It therefore seems impossible to write correct XS code except for fairly simple cases.

            When I croak() myself I can clean up any resources allocated so far, but I may be calling functions that croak() directly which would sidestep any cleanup code I write.

            Pseudo-code to illustrate my concern:

            ...

            ANSWER

            Answered 2017-Aug-21 at 09:56

            Upon further research, it turns out that SAVEDESTRUCTOR is in fact documented – in perlguts rather than perlapi. The exact semantics are documented there.

            I therefore assume that SAVEDESTRUCTOR is supposed to be used as a "finally" block for cleanup, and is sufficiently safe and stable.

            Excerpt from Localizing changes in perlguts, which discusses the equivalent to { local $foo; ... } blocks:

            There is a way to achieve a similar task from C via Perl API: create a pseudo-block, and arrange for some changes to be automatically undone at the end of it, either explicit, or via a non-local exit (via die()). A block-like construct is created by a pair of ENTER/LEAVE macros (see Returning a Scalar in perlcall). Such a construct may be created specially for some important localized task, or an existing one (like boundaries of enclosing Perl subroutine/block, or an existing pair for freeing TMPs) may be used. (In the second case the overhead of additional localization must be almost negligible.) Note that any XSUB is automatically enclosed in an ENTER/LEAVE pair.

            Inside such a pseudo-block the following service is available:

            • […]

            • SAVEDESTRUCTOR(DESTRUCTORFUNC_NOCONTEXT_t f, void *p)

              At the end of pseudo-block the function f is called with the only argument p.

            • SAVEDESTRUCTOR_X(DESTRUCTORFUNC_t f, void *p)

              At the end of pseudo-block the function f is called with the implicit context argument (if any), and p.

            The section also lists a couple of specialized destructors, like SAVEFREESV(SV *sv) and SAVEMORTALIZESV(SV *sv) that may be more correct than a premature sv_2mortal() in some cases.

            These macros have basically been available since effectively forever, at least Perl 5.6 or older.

            Source https://stackoverflow.com/questions/45784972

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install xs-fun

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/xsawyerx/xs-fun.git

          • CLI

            gh repo clone xsawyerx/xs-fun

          • sshUrl

            git@github.com:xsawyerx/xs-fun.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link