[- garghhh - please ignore earlier partial email ]

> Not sure of the fine details of how you're going about this - so I built a
> module (that works independent of Inline) based around the
> grammar/t/04const.t code (in the Inline::CPP source distro). I've
reproduced
> the files I used below my sig. Hope there's something there that helps -
> though it's fairly simplistic, and faik, I may have simplified away the
very
> issues that are confronting you :-)

:) 

I'm (again) trying to get a CPAN-style package that will build on a machine
without Inline.  Following your recommendation, I've made these files, using
the outline from your prior email.  I'm trying to understand what's actually
happening, rather than just trusting a cookbook approach, which I find isn't
maintainable even by me.  So far, I'm pretty sure I'm missing some key
understanding(s).  Your help would be very much appreciated.

More details:

I want Inline::CPP, not for the class parsing, but so that I can use C++
classes as part of my procedural C code.  Perhaps a bit cheezy, but there it
is.  Oh, one of those classes is Boost regex, among others.

I made a foo.cpp file that has a function SV *foo( const char *a, const char
*b, SV *c, const char *d ), which uses a foo.h file for other stuff.  I'm
including this from my foo.pl by using a bit of fancy footwork so that when
I #include "$dirname/foo.cpp" gets the right file - this seems to work just
fine.   I ran the script and grabbed the Makefile.PL and the '.xs' file -
there was no '.map' file.

I then started adjusting the Makefile.PL and the .xs file, and creating
MANIFEST, Foo.pm and test.pl:

MANIFEST:
-----------
Changes
Makefile.PL
README
Foo.pm
test.pl
foo.h
foo.cpp
-----------

Makefile.PL:
-----------
use ExtUtils::MakeMaker;
my %options = %{
{
  'NAME' => 'Foo',
  'TYPEMAPS' => [],
  'LIBS' => [
    '-lstdc++ -L/home/y/lib -lboost_regex'
  ],
  'CC' => 'g++',
  'VERSION' => '0.06'
}
};
WriteMakefile(%options);

# Remove the Makefile dependency. Causes problems on a few systems.
sub MY::makefile { '' }

foo.xs
-----------
#ifndef bool
#include <iostream.h>
#endif
extern "C" {
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
}
#ifdef bool
#undef bool
#include <iostream.h>
#endif

#include "foo.cpp"

SV *foo( const char *a, const char *b, SV *c, const char *d ) {
    return( _foo(a,b,c,d) );
}
MODULE = Foo    PACKAGE = My::Foo

PROTOTYPES: DISABLE

SV *
foo(a, b, c, d)
    char *  a
    char *  b
    SV *    c
    char *  d
-----------

Foo.pm
-----------
package My::Foo;

    use strict;
    require Exporter;
    require DynaLoader;

    @My::Foo::ISA = qw(Exporter DynaLoader);

    $My::Foo::VERSION = '0.06';

    bootstrap Foo $My::Foo::VERSION;

1;
-----------

When I run make disttest, I get this:

/home/y/bin/perl -I/home/y/lib/perl5/5.6.1/i386-freebsd
-I/home/y/lib/perl5/5.6.1 -MExtUtils::Manifest=manicopy,maniread  -e
"manicopy(maniread(),'Referrals-0.06', 'best');"
mkdir Foo-0.06
cd Foo-0.06 && /home/y/bin/perl -I/home/y/lib/perl5/5.6.1/i386-freebsd
-I/home/y/lib/perl5/5.6.1 Makefile.PL
Writing Makefile for Foo
cd Foo-0.06 && make
cp Foo.pm blib/lib/Foo.pm
Running Mkbootstrap for Foo ()
chmod 644 Foo.bs
rm -f blib/arch/auto/Foo/Foo.so
LD_RUN_PATH="/usr/lib:/home/y/lib" gcc  -shared  -L/home/y/lib
-L/usr/local/lib Foo.o  -o blib/arch/auto/Foo/Foo.so   -lstdc++
-L/home/y/lib -lboost_regex
gcc: Foo.o: No such file or directory

Any recommendations?

Thanks,

Randy

Reply via email to