When I build an XS module using Inline, I start off with a makefile that looks like this:
----------------------------- use Inline::MakeMaker; WriteMakefile( NAME => 'MyModule', VERSION_FROM => 'MyModule.pm', ); -----------------------------
Then I run 'perl Makefile.PL', 'make', etc. and all works fine.
But suppose I wish to define a symbol (at the preprocessor stage) using makemaker - say something like:
----------------------------- use Inline::MakeMaker; $define = '_RAND15'; WriteMakefile( NAME => 'MyModule', VERSION_FROM => 'MyModule.pm', DEFINE => "-D$define", ); -----------------------------
I'm finding that the 'DEFINE' option is not being passed on to the Makefile.pl that gets used (in the build directory) to build the module.
Consequently '_RAND15' is *not* defined.
How do I write my 'Makefile.PL' so that '_RAND15' gets defined ?
Of course in the real life situation, you wouldn't need to define the symbol in the Makefile.PL - you'd simply do a '#define _RAND15' in the C section of the code.
But suppose that symbol needs to be set *conditionally*. eg:
if($Config{'randbits'} == 15) {$define = '_RAND15'} else {$define = '_RANDXX'}
Can the C preprocessor readily handle that type of conditionality ?
I tried passing the 'DEFINE' value as an Inline::C config option but, that croaks because "'DEFINE' is not a valid config option for Inline::C".
Is it necessary to hack at Inline::MakeMaker ?
Cheers, Rob
--
Any emails containing attachments will be deleted from my ISP's mail server before I even get to see them. If you wish to email me an attachment, please provide advance warning so that I can make the necessary arrangements.