Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small problem #870

Closed
p5pRT opened this issue Nov 18, 1999 · 2 comments
Closed

small problem #870

p5pRT opened this issue Nov 18, 1999 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 18, 1999

Migrated from rt.perl.org#1801 (status was 'resolved')

Searchable as RT1801$

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 1999

From kevinr@col.hp.com

http​://www.perl.com/CPAN-local/doc/manual/html/pod/perlembed.html#Compiling_your_C_program

and I had trouble compiling the string.c example. Specifically the
line​:

printf("a = %s\n", SvPV(perl_get_sv("a", FALSE), PL_na));

was the trouble maker. PL_na was undefined. I did, however, find​:

/opt/perl5/lib/CORE/perl.h​:EXT STRLEN na; /* for use in
SvPV when length is Not Applicable */

So I changed the line to the following and it compiles/runs just fine.

printf("a = %s\n", SvPV(perl_get_sv("a", FALSE), na));


perl -V gives​:
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration​:
  Platform​:
  osname=hpux, osvers=10, archname=PA-RISC1.1
  uname='hp-ux fat-tire b.10.20 c 9000712 2013492182 32-user license '

  hint=previous, useposix=true, d_sigaction=define
  bincompat3=y useperlio=undef d_sfio=undef
  Compiler​:
  cc='cc', optimize='-O', gccversion=
  cppflags='-D_HPUX_SOURCE -Aa'
  ccflags ='-D_HPUX_SOURCE -Aa'
  stdchar='unsigned char', d_stdstdio=define, usevfork=false
  voidflags=15, castflags=0, d_casti32=define, d_castneg=define
  intsize=4, alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries​:
  ld='ld', ldflags =''
  libpth=/usr/lib/X11R5 /usr/lib /usr/lib/pa1.1 /usr/ccs/lib
  libs=-lnet -lnsl_s -lndbm -ldld -lm -lc -lndir -lcrypt
  libc=/lib/libc.1, so=1
  useshrplib=false, libperl=libperl.a
  Dynamic Linking​:
  dlsrc=dl_hpux.xs, dlext=1, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-B,deferred '
  cccdlflags='+z', lddlflags='-b'

Characteristics of this binary (from libperl)​:
  Built under hpux
  Compiled at Dec 11 1997 10​:23​:49
  @​INC​:
  /opt/perl5/lib
  /site/lib/perl
  /site/lib/perl
  .


I am compiling with​:

cc -D_HPUX_SOURCE -Aa \
-I/usr/local/include \
-I/opt/perl5/lib/CORE \
-L/opt/perl5/lib/CORE \
-L/usr/local/lib \
-o $1 $1.c -lperl -lm


I know this isn't a "perl" or "document" bug but I think ironing out
examples helps,
especially for a novice user such as myself.

Thanks for making these examples available!

Kevin Ryan

kevin_ryan@​agilent.com

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 1999

From [Unknown Contact. See original ticket]

Kevin Ryan <kevinr@​col.hp.com> writes​:

I was in​:

http​://www.perl.com/CPAN-local/doc/manual/html/pod/perlembed.html#Compiling_your_C_program

That documents up-to-date perl i.e. perl5.005+

and I had trouble compiling the string.c example. Specifically the
line​:

printf("a = %s\n", SvPV(perl_get_sv("a", FALSE), PL_na));

was the trouble maker. PL_na was undefined. I did, however, find​:

/opt/perl5/lib/CORE/perl.h​:EXT STRLEN na; /* for use in
SvPV when length is Not Applicable */

So I changed the line to the following and it compiles/runs just fine.

printf("a = %s\n", SvPV(perl_get_sv("a", FALSE), na));

------------------------------------------------------------
perl -V gives​:
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration​:

Yes for old perl5.00404 it used to be called 'na' - we changed it
so that all the variable names are consistently prefixed PL_ to avoid
clashes with user variables. While 'na' may not be too much of a problem
'dirty' and serveral others were a real problem.

--
Nick Ing-Simmons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant