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

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



Title: Re: [MacPerl-Modules] Extension not printing to MacPer
Re: my 'printf' in a simple extension not showing up in the MacPerl window:

At 11:44 AM -0300 7/27/99, Arved Sandstrom wrote:
>Hi, Rudi
>
>I can't try it until this evening, but likely your problem has to do with
>where printf() is being defined. Using DumpPEF in MPW, or looking at you
>link map in the CW IDE, if you checked off that option, will tell you
>what library printf() is being grabbed from.
>
>printf() occurs in Perl, also. The default system include path is allowing
>you not to declare <stdio.h>, although you ought to put that in, but
>depending on the link order of your libraries, it may well be that the
>linker is picking up the stub for printf, not the code ref in the C
>library. Easy enough to find out. If that's the case, move your libraries
>around.
>
>Also, in XS code it doesn't hurt to use the Perl IO abstraction,
>documented in the 'perlio' manpage. The counterpart to printf is
>PerlIO_stdoutf().
>
>As regards what libraries you need in general, unless you intend to
>rebuild MacPerl the libraries that come with Codewarrior are all you'll
>ever need to build extensions. This goes for Toolbox also.
>
>Arved


Thanks muchly.  Got it printing to MacPerl window, although I hade to remove some libraries rather than just move them around.

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.

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?

Thanks again,

Rudi

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?
==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-modules-request@macperl.org