Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by BrowserUk (Pope)
on Oct 25, 2011 at 16:15 UTC ( #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
Node Status?
node history
Node Type: note [id://933648]
help
Chatterbox?
[hippo]: Make it an option?
[Corion]: hippo: Yes, but I'm not sure that it's even worth the effort of implementing it at all...
[Corion]: You'll only ever need that option if you have a long-running query whose results are not cached by your DB already, and in those cases I presume that the programmer will want to maintain the temporary tables themselves - I wouldn't know when to drop ...
[Corion]: ... the temporary tables, and also don't have a good idea on how to create unique table names for them
[hippo]: OIC. In that case leave it out but invite feature requests and see if any of the users suggest it. :-)
[Corion]: Talking about this makes me realize that it's likely only a half useful idea. But it still would be convenient to have as an option...
[Corion]: hippo: Hmmm - yeah, I could document it and wait for code implementing that option to show up ;-D

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2017-02-23 15:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (347 votes). Check out past polls.