Reverends monks, I humbly ask for your wisdom to elighten me.....
I found this weird behavior of a C program embedding perl. If you compile the enclosed program by
cc -o test test.c -Wall `perl -MExtUtils::Embed -e ccopts -e ldopts`
and then execute the resulting executable, then: This looks weird :( Should I fill a bug report, or simply I made a mess? :)))
humbly waiting for a reply :)

/*test.c*/ #include <EXTERN.h> /* from the Perl distribution */ #include <perl.h> /* from the Perl distribution */ #include <stdio.h> #include <locale.h> static PerlInterpreter *my_perl; /*** The Perl interpreter ***/ static char *perl_args[] = { "", "-e", "0", "-w" }; static char perl_script[] = { "use IO::Socket;\n" "my $sock = new IO::Socket::INET or die qq/Can't create socket!/;\n" "print qq/Done\n/;" }; extern void xs_init _((void)); extern void boot_DynaLoader _((CV * cv)); void xs_init () { char *file = __FILE__; /* this allows using dynamicaly loaded modules... see perlembed manpage*/ newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); } int main(int argc, char **argv, char **env) { setlocale (LC_ALL, ""); fprintf(stderr,"Locale value for NUMERIC is %s\n",setlocale(LC_NUMER +IC,NULL)); my_perl = perl_alloc(); perl_construct(my_perl); perl_parse(my_perl, xs_init, 4, perl_args, (char **)NULL); perl_eval_pv(perl_script,(I32) NULL); perl_destruct(my_perl); perl_free(my_perl); exit(0); }


TheHobbit

In reply to Embedded Perl, LC_NUMERIC and the $ variable. by TheHobbit

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.