Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Generating a header file to be included by the C/XS code seems to be the more portable approach

That's probably sort of what I'm doing - and my initial post oversimplified things.
See this Scalar-List-Utils bug report for a better picture.

The real issue is that MY_FORMAT needs to be defined to "%.17" (if NV is 64 bit), to be defined to "%.21" (if NV is 80 bit), to be defined to "%.36" (if NV is 128 bit).
It's quite easy during the Makefile.PL processing to determine which it needs to be - and surely the simplest thing to do is to just have the Makefile.PL define MY_FORMAT to the correct string.
But you're right ... and jcb's suggestion (along with several variations thereof) is not working.

At the moment, the Makefile.PL is doing:
.... if($Config{nvsize} == 8) { $nvtype = 'LU_NV_IS_64_BIT' } # double o +r 8-byte long double elsif(length(sqrt 2) > 25) { $nvtype = 'LU_NV_IS_128_BIT' } # IEEE lon +g double or __float128 else { $nvtype = 'LU_NV_IS_80_BIT' } # extended + precision long double $defines .= " -D$nvtype"; .... WriteMakefile ( .... DEFINE => $defines, .... );
And the XS file is rewritten to redefine the symbol to the appropriate value:
#if defined(LU_NV_IS_64_BIT) #define MY_FORMAT "%.17" #elif defined(LU_NV_IS_80_BIT) #define MY_FORMAT "%.21" #else #define MY_FORMAT "%.36" #endif
It's working fine .... but I feel that I should be able to define MY_FORMAT directly within the Makefile.PL and avoid having to add that preprocessing to the XS file ??


In reply to Re^3: Defining an XS symbol in the Makefile.PL by syphilis
in thread Defining an XS symbol in the Makefile.PL by syphilis

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (7)
    As of 2019-10-21 22:36 GMT
    Find Nodes?
      Voting Booth?