Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Exploring Inline::C (Generating primes)

by BrowserUk (Patriarch)
on Oct 25, 2011 at 16:15 UTC ( [id://933648]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Exploring Inline::C (Generating primes)
in thread Exploring Inline::C (Generating primes)

is Inline::C able to use the #line directive?

Theoretically yes. But ...

The XS pre-compiler already uses (something like) this to try and make error messages produce by the C compiler relate to line numbers in the .XS file.

Inline::C extracts the source code from the .pl file, places it into an .XS file with some requisite pre- and post-amble, and then pre-compiles that to produce the the .c file. That then gets compiled to build a .dll/.so binary that is then dynamically linked back to the perl binary at runtime.

I don't think anyone has tried to apply two levels of line control simultaneously. I'm not sure we humans would understand the results :)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^3: Exploring Inline::C (Generating primes)

Replies are listed 'Best First'.
Re^4: Exploring Inline::C (Generating primes)
by tsee (Curate) on Oct 26, 2011 at 06:14 UTC

    I think the best way to enable Inline::C using #line directives would be to implement an xsubpp (== ExtUtils::ParseXS) option to NOT generate #line directives. That shouldn't be hard.

    ...

    Oops! Turns out that's already done! Check out the linenumbers option. I haven't tested it, though.

    This being said, I believe Inline::C is a deployment nightmare and should be avoided outside experiments accordingly.

    Once you learned the C and perlapi stuff to write Inline::C, XS is child's play.

      Check out the linenumbers option.

      What "linenumber options"? Options to what?

      I believe Inline::C is a deployment nightmare ... XS is child's play.

      Inline::C is a much nicer development environment than XS. Edit -> Run; Edit -> Run.

      Just like using your favourite dynamic language except for a somewhat extended delay and some annoying trace output.

      The only thing that's missing is a "BUILD_DISTRIBUTION => 1" config flag, then it would be perfect.

      In theory, automating the generation of a distribution should be simple. At least for anything that doesn't use external libraries.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        Thanks for quoting a part of my post when the preceding text makes it clear what the option refers to. Or so I assumed. The answer is, of course, xsubpp / ExtUtils::ParseXS.

        As for BUILD_DISTRIBUTION, have you seen InlineX::C2XS InlineX::XS?

Log In?
Username:
Password:

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

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

    No recent polls found