Hey Dudes,

I have a couple of deeply nested (directory wise and namespace) XS files that I want to include in an already long developed perl module. h2xs is not my friend in this case as it tends to like creating new files...

(names have been changed for simplification)

The XS file (which has all of the c code in it) has a name of lib/MyModule/Drv/MyCode.xs and contain the lines

MODULE = MyModule::Drv::MyCode PACKAGE = MyModule::Drv::MyCode PROTOTYPES: DISABLE

and the rest of the normal code.

My corosponding lib/MyModule/Drv/MyCode.pm contains

package MyModule::Drv::MyCode; use strict; use Carp; use vars qw($VERSION @ISA @EXPORT); require DynaLoader; @ISA = qw(DynaLoader); $VERSION = '0.1'; bootstrap MyModule::Drv::MyCode $VERSION;
and the rest of the normal code.

My MANIFEST file in the root directory contains

lib/Device/ParallelPort/drv/linux.pm lib/Device/ParallelPort/drv/linux.xs
amoung other lines Finally my Makefile.PL complete, looks like this:
use ExtUtils::MakeMaker; WriteMakefile( 'NAME' => 'MyModule', 'VERSION_FROM' => 'lib/MyModule.pm', 'LIBS' => [''], 'DEFINE' => $dflags, 'INC' => '', );
I have tried varying things like adding
'XS' => { 'lib/MyModule/Drv/MyCode.xs' => 'lib/MyModule/Drv/MyCode.c', },
The problem is that the resulting Makefile from "perl Makefile.PL" does not compile my .xs file. Sometimes (depending on the many tests I have tried) it compiles MyModule.xs - which does not exist.

I can only get it to work if the .xs file is in the root directory.

Does anyone have any idea how I can fix this.

Much Appreciated in advance :-)

Scott


In reply to XS compile in Makefile.PL by scottp

Title:
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, 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:
    & &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.