Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^6: Defining an XS symbol in the Makefile.PL (quoting)

by syphilis (Bishop)
on Aug 19, 2019 at 12:05 UTC ( #11104687=note: print w/replies, xml ) Need Help??


in reply to Re^5: Defining an XS symbol in the Makefile.PL (quoting)
in thread Defining an XS symbol in the Makefile.PL

Heh, whats going on?

Good question ... I don't have an answer to that ;-)

Your code still results in the same error for me: fatal error: EXTERN.h: No such file or directory.
Looks like the "-iquote" that my Inline-C-0.81 invokes is stuffing things up.

UPDATE: No, it has nothing to do with "-iquote". Turns out that when I switched to I-C-0.76 I also switched to EU-MM-7.04, and the problem I'm facing is due solely to a change that occurs in EU::MM some time between 7.0401 (which is fine) and 7.1001 (which breaks Inline::C). I'll investigate further when I get a chance and file a bug report if warranted.

What version of Inline::C are you running ? When I switch to Inline-C-0.76, your script works fine - as does mine if I replace the incorrect SV * foo(... with void foo(....

But now I'm puzzled as to the output we get for printf("***%s***\n", MY_FORMAT);
The quotes either side of %.17e are apparently missing from MY_FORMAT. So how does printf(MY_FORMAT, sqrt(2.0)) even compile ?
Can you explain that ?

BTW, seems that my problem with finding a correct rendition for the DEFINE in the Makefile.PL is dependent upon the version of EU::MM.
With EU-MM-7.04, this is fine:
DEFINE => q["-DMY_FORMAT=\\"%.17\\""];
But with EU-MM-7.34 (which is what I've been using) the crucial percentage symbol is still being omitted.

Cheers,
Rob

Replies are listed 'Best First'.
Re^7: Defining an XS symbol in the Makefile.PL (quoting)
by jcb (Hermit) on Aug 19, 2019 at 22:45 UTC
    But now I'm puzzled as to the output we get for printf("***%s***\n", MY_FORMAT); The quotes either side of %.17e are apparently missing from MY_FORMAT. So how does printf(MY_FORMAT, sqrt(2.0)) even compile ?

    C syntax and preprocessing rules. MY_FORMAT is substituted by the C preprocessor, so the compiler sees printf("***%s***\n", "%.17e");, strips the quotes off of the string constant like any other, and the output is ***%.17e*** if everything works correctly. The % character is also special in the DOS shell, which uses it for variable substitution: %PATH% on DOS is $PATH on *nix. The trailing % is required, but I would not be surprised if bugs in the shell like to eat random % characters.

    You will be much better off passing a number instead of a string constant if you want this to compile on Windows.

      ..so the compiler sees printf("***%s***\n", "%.17e");, strips the quotes off of the string constant like any other ...

      Oh yes, of course. Silly me.
      Thanks !

      Cheers,
      Rob
Re^7: Defining an XS symbol in the Makefile.PL (quoting)
by Anonymous Monk on Aug 21, 2019 at 01:26 UTC
    Inline 0.80 Inline::C 0.76 ExtUtils::MakeMaker 7.20

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11104687]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2019-09-23 16:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (280 votes). Check out past polls.

    Notices?