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

Re: Using stderr from Inline::C: (part deux)

by hdb (Parson)
on May 23, 2013 at 07:31 UTC ( #1034902=note: print w/ replies, xml ) Need Help??


in reply to Using stderr from Inline::C: (part deux)

This might not be of great help to you, but under Win32 strawberry-perl 5.16.3.1 #1 Tue Mar 12 12:12:07 2013 x64 the following code works:

use strict; use Inline C => <<'__C__'; #include <stdio.h> void test ( ) { char buffer[] = { 'x' , 'y' , 'z' }; fwrite (buffer, 1, sizeof(buffer), stderr ); } __C__ test( );

Reading your old thread, it looks to me that the root cause of the problem was a mismatch of compilers. So one solution could be to either change compilers or re-compile Perl with your preferred compiler.


Comment on Re: Using stderr from Inline::C: (part deux)
Select or Download Code
Re^2: Using stderr from Inline::C: (part deux)
by BrowserUk (Pope) on May 23, 2013 at 09:52 UTC
    the root cause of the problem was a mismatch of compilers.

    Kinda. Sorta. But not really.

    I::C code is compiled to a runtime linked dll. There is nothing fundamentally wrong with using multiple different CRTs within different dlls in the same process. (provided you don't try to mix'n'match by (say) mallocing with one and freeing with another.)

    Indeed, this is (so far; but I've been doing it for a good many years) the only real problem I've encountered with using a different compiler for building modules and I::C stuff, than was used to build the AS perl I use.

    The problem is that the Perl headers pull in a shitload of the PerlIO crap regardless of whether the code being compiled uses it or not. And it is that PerlIO crap that is screwing this up.

    So one solution could be to either change compilers or re-compile Perl with your preferred compiler.

    Neither of those is an option. It has to be AS perl. The compiler AS use is no longer available; neither is (their) source for the build of Perl I need for this.

    But thanks for your reply.


    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. That looks interesting. I'm just not yet sure if it is possible to use with I::C given that it prepends the headers to your code, there is no way I can see of defining that before the headers get included.


        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://1034902]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (19)
As of 2014-04-16 11:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (424 votes), past polls