in reply to Re^3: Defining an XS symbol in the Makefile.PL
in thread Defining an XS symbol in the Makefile.PL
Actually, what you are actually doing is probably a better option. Getting strings through varying shell quoting rules is asking for trouble.
And that leads to another option:
in Makefile.PL:
if($Config{nvsize} == 8) { $nvbits = 64 } elsif(length(sqrt 2) > 25) { $nvbits = 128 } else { $nvbits = 80 } $defines .= ' -DLU_NV_BITS='.$nvbits;
in XS code:
#if LU_NV_BITS == 64 #define MY_FORMAT "%.17" #elif LU_NV_BITS == 80 #define MY_FORMAT "%.21" #elif LU_NV_BITS == 128 #define MY_FORMAT "%.36" #else #error "LU_NV_BITS not set" #endif
Passing a numeric parameter through the shell does not require quoting at all.
You could also just pass the number of digits you want, but converting that back to a string in the C preprocessor requires macro tricks documented in the GNU CPP manual.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Defining an XS symbol in the Makefile.PL
by syphilis (Archbishop) on Aug 18, 2019 at 09:40 UTC | |
by jcb (Parson) on Aug 18, 2019 at 22:35 UTC | |
by syphilis (Archbishop) on Aug 19, 2019 at 01:40 UTC | |
by jcb (Parson) on Aug 19, 2019 at 02:40 UTC | |
by syphilis (Archbishop) on Aug 19, 2019 at 14:04 UTC | |
|