Wilson Snyder wrote:


I see Inline working and caching OK, but what I would like is that a 'make' in my package dir prebuilds all of the C++ code. In your manpages, I see a suggestion that this should be possible:


     Code that is Inlined into distributed
     modules (like on the CPAN) will get compiled when the mod�
     ule is installed, so the end user will never notice the
     compilation time.


but I'm presumably missing some magic MakeMaker stuff.  Any hints?  (Or even,
a "See package Foo that does that.")


Within the Inline-0.44 source there's a module called Math::Simple that you can build and install using Inline::C. It's just a matter of cd'ing to the source directory and running the usual 'perl Makefile.PL', 'make test' and 'make install'. (See 'perldoc Inline-FAQ' for some additional discussion about this.)


You can probably also build and install Math::Simple with Inline::CPP. So give it a try - if it works then you need only mimic that setup with your module. (To use Inline::CPP instead of Inline::C for the building you'll need to perform a simple hack or 2 to the source files - ie change 'Inline C' to 'Inline CPP'.)

Be aware that building Math::Simple like that (obviously) needs the Inline module - and that running Math::Simple (not so obviously) also needs the Inline module.

If, however, you take the XS file that Inline generates when Math::Simple is being built, you can use it in a normal cpan source type distribution form which Math::Simple can be both built and run, completely independently of Inline. (The XS file, and all other files created during the build process, are normally automatically deleted when the build process has finished. To save them you need to set the Config option 'CLEAN_AFTER_BUILD => 0,'.) I think you'll also need to put the C++ code in a separate file - how to do that is also mentioned in the 'Inline-FAQ'.

I know from experience that this all works nicely with Inline::C, and I assume the same will be true of Inline::CPP - but I don't *know*.

Give it a try and report back with any problems :-)

Cheers,
Rob




Reply via email to