Had an xs module working fine then decided to get fancy with opque 
structs.

Using the example from 
CookBookA - Dean's Extension-Building Cookbook, part A.

I put together and 'almost identical' sample that gives me an error
I can't figure out.

Can't locate auto/BZS/TEST/xx.al in @INC

the .al file does really does not exist nor does a similar file exist 
in the CookbookA example.

The code differs only in the struct definition names
can anyone see the problem??

sorry bout the long post, but......

############### test.pl
#!/usr/bin/perl

use strict;
require BZS::TEST;

my $p = BZS::TEST->new;

my $x = $p->xx;

print "x=$x\n";

################## BZS::TEST.pm
package BZS::TEST;

require DynaLoader;

our @ISA = 'DynaLoader';

our $VERSION = '0.01';

bootstrap BZS::TEST $VERSION;

1;

#################### Makefile.PL
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    'NAME'              => 'BZS::TEST',
    'DISTNAME'          => 'BZS-TEST',
    'VERSION_FROM'      => 'TEST.pm', # finds $VERSION
    'OBJECT'            => 'TEST.o',
    'XSPROTOARG'        => '-noprototypes',
    'TYPEMAPS'          => ['perlobject.map' ],
    'dist'              => {COMPRESS=>'gzip', SUFFIX=>'gz'}
);

#################### TEST.xs
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

typedef struct{
        int xx;
        int yy;
        char state[256];
} TEST_Key;

#ifdef __cplusplus
}
#endif

MODULE = BZS::TEST      PACKAGE = BZS::TEST

TEST_Key *
new(CLASS)
        char            * CLASS
    CODE:
        RETVAL = (TEST_Key *)safemalloc( sizeof( TEST_Key ) );
        if ( RETVAL == NULL ) {
                warn("new_key: unable to malloc Key");
                XSRETURN_UNDEF;
        }
 RETVAL->xx = 19;
 RETVAL->yy = 2;
 strcpy( RETVAL->state, "some string");
    OUTPUT:
        RETVAL


void
DESTROY(self)
        TEST_Key * self
    CODE:
        safefree( (char *)self);

########### typemap
TYPEMAP
TEST_Key *      O_OBJECT

[EMAIL PROTECTED]

Reply via email to