[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-Modules] Extension not printing to MacPerl window



Quoting Rudi Sherry <rudi_sherry@loftsoft.com>:

    DumpPEF of the linked XPlusX library didn't show printf, but
    DumpPEF of PerlStub did (as a TVector).  I still had the two MSL
    libraries linking ("MSL RuntimePPC.Li" and "MSL
    C.PPC.Lib"), which turned out to be a mistake.  I removed
    them (listed last in DYNAMIC_STDLIBS_PPC)
    from the link and it started working.  That is, it
    started importing the TVector 'printf' from PerlStub rather than
    using glue code inside the MSL  C.PPC.Lib library  -- I'm
    not sure those two libraries are needed at all anymore.

The libraries you actually need vary quite a bit. It's quite instructive
to start out with *only* PerlStub, and add other libraries based on the
linker messages. Sometimes you just need to add one or two others.

    However, after doing the above, it was printing "0"
    (incorrect) instead of "5" (correct) -- but changing
    printf() to PerlIO_stdoutf() made it work, and also made it import
    _stdprintf from PerlStub rather than printf.  Perhaps it didn't
    work because it was C-compiling with the PerlIO_stdoutf() prototype,
    but PerlStub's printf glue takes parameters in a different way?

I'm still trying to get my head wrapped around what's occurring here. :-)
The other issue here is that MacPerl uses the "sfio" library, which
although I haven't looked presumably has a printf(). A real printf(), with
code. So this probably is what was being used when you got the '0'.

Somebody can correct me, but I believe that an output problem with respect
to the "%.0f" format string in sfio's printf() was the subject of discussion 
here some months back. Larry? So you may have had everything OK, and the
thing wouldn't have worked anyhow.

For any number of reasons I use the Perl IO API in XS code. That's why it's
there, after all, and there is no ambiguity as to where the code is coming
from.

    PS. The only documentation I found for PerlIO_* is in
    :pod:perlapio.pod -- I couldn't find any manpages for perlio in my
    MacPerl tree or on my ISP's server.  Is it new?

My bust. The title of the POD is "perlio", but the filename is "perlapio".

Arved


---------------------------------------------------------------
 This mail was sent through the Nova Scotia Provincial Server.
 http://nsaccess.ns.ca/mail/ (in development)

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-modules-request@macperl.org