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 ??
Cheers,
Rob
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.