Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by MidLifeXis (Monsignor)
on Oct 25, 2011 at 12:45 UTC ( #933613=note: print w/ replies, xml ) Need Help??


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

It has been a while since I have coded anything extensive (for some definition of extensive) in C, but I seemed to remember being able to tweak the line number and file name reported by the compiler by using #line... directives. A little searching indicates that my memory was correct.

Not having used Inline::C to this point, this question is being asked from an ignorant position: is Inline::C able to use the #line directive?

--MidLifeXis


Comment on Re^2: Exploring Inline::C (Generating primes)
Select or Download Code
Re^3: Exploring Inline::C (Generating primes)
by BrowserUk (Pope) on Oct 25, 2011 at 16:15 UTC
    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.

      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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2015-07-02 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (47 votes), past polls