Hello

For the access to IGT+ (Bankingsystem), I am writing a Module in Perl. What
I have is:
1.) static library libhl_api.a
2.) a headerfile igt_hl_api.h

A part of the content is as below:

<BEGIN CODE>
/* Directions */
#define IGT_HL_DIR_INCOM        0       /* IGT  --> Host */
#define IGT_HL_DIR_OUTGO        1       /* Host --> IGT  */

#define IGT_HL_MIN_ERROR        -3000

/* Error Codes returned from API functions */
#define IGT_HL_WRONG_DIR        (IGT_MIN_ERROR+1)
#define IGT_HL_WRONG_HOST       (IGT_MIN_ERROR+2)
#define IGT_HL_WRONG_IP         (IGT_MIN_ERROR+3)
#define IGT_HL_WRONG_PORT       (IGT_MIN_ERROR+4)
#define IGT_HL_WRONG_TIMEOUT    (IGT_MIN_ERROR+5)
#define IGT_HL_WRONG_WINDOW     (IGT_MIN_ERROR+6)
#define IGT_HL_OP_IN_PROGRESS   (IGT_MIN_ERROR+7)
#define IGT_HL_NO_INIT          (IGT_MIN_ERROR+8)
#define IGT_HL_NO_CONNECTION    (IGT_MIN_ERROR+9)
#define IGT_HL_LOGIN_TIMEOUT    (IGT_MIN_ERROR+10)
#define IGT_HL_ACK_TIMEOUT      (IGT_MIN_ERROR+11)
#define IGT_HL_MSG_TIMEOUT      (IGT_MIN_ERROR+12)
#define IGT_HL_SOCKET_ERROR     (IGT_MIN_ERROR+13)
#define IGT_HL_NAK_RECEIVED     (IGT_MIN_ERROR+14)
#define IGT_HL_WRONG_ACK        (IGT_MIN_ERROR+15)
#define IGT_HL_MESSAGE_ERROR    (IGT_MIN_ERROR+16)
#define IGT_HL_NO_MSG_OPEN      (IGT_MIN_ERROR+17)
#define IGT_HL_NO_MEMORY        (IGT_MIN_ERROR+18)   /* Insufficient memory
                                                           or other resource
*/
#define IGT_HL_WRONG_DUPL       (IGT_MIN_ERROR+19)
#define IGT_HL_WRONG_ROUTE      (IGT_MIN_ERROR+20)
#define IGT_HL_DISCONNECTED     (IGT_MIN_ERROR+50)
#define IGT_HL_NOT_IMPLEMENTED  (IGT_MIN_ERROR+100)

#define IGT_HL_OK               1
#define IGT_HL_NOK              -1

/* Trace Levels */
#define IGT_HL_NO_TRACE         0x00
#define IGT_HL_ERR_TRACE        0x01
#define IGT_HL_MIN_TRACE        0x02
#define IGT_HL_MSG_TRACE        0x04
#define IGT_HL_MAX_TRACE        0x08
#define IGT_HL_ALL_TRACE        0x0F

#define IGT_HL_MAX_TIMEOUT      100000
#define IGT_HL_MAX_WINDOW       1
#define IGT_HL_MIN_WINDOW       1
#define IGT_HL_MIN_PORT         1024
#define IGT_HL_MAX_PORT         65535
<END CODE>

These constants are needed in the module. I created the first prototype with
h2xs an modified the Makefile.PL, so that the binding of the static library
works. The methods of the new module banking::igtplus are working, only
with the constants I get problems. For example the use of
banking::igtplus::IGT_HL_MSG_TIMEOUT causes a segmentation fault. but not
the use of banking::igtplus::IGT_HL_OK. From where this comes from? What
can I do? Is it possible to define these constants in igtplus.pm, and how
must I do that?

Here some additional files:


const-xs.inc:
-------------
void
constant(sv)
    PREINIT:
#ifdef dXSTARG
        dXSTARG; /* Faster if we have it.  */
#else
        dTARGET;
#endif
        STRLEN          len;
        int             type;
        IV              iv;
        /* NV           nv;     Uncomment this if you need to return NVs */
        /* const char   *pv;    Uncomment this if you need to return PVs */
    INPUT:
        SV *            sv;
        const char *    s = SvPV(sv, len);
    PPCODE:
        /* Change this to constant(aTHX_ s, len, &iv, &nv);
           if you need to return both NVs and IVs */
        type = constant(aTHX_ s, len, &iv);
      /* Return 1 or 2 items. First is error message, or undef if no error.
           Second, if present, is found value */
        switch (type) {
        case PERL_constant_NOTFOUND:
          sv = sv_2mortal(newSVpvf("%s is not a valid banking::igtplus
macro", s));
          PUSHs(sv);
          break;
        case PERL_constant_NOTDEF:
          sv = sv_2mortal(newSVpvf(
            "Your vendor has not defined banking::igtplus macro %s, used", s));
          PUSHs(sv);
          break;
        case PERL_constant_ISIV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHi(iv);
          break;
        /* Uncomment this if you need to return NOs
        case PERL_constant_ISNO:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHs(&PL_sv_no);
          break; */
        /* Uncomment this if you need to return NVs
        case PERL_constant_ISNV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHn(nv);
          break; */
        /* Uncomment this if you need to return PVs
        case PERL_constant_ISPV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHp(pv, strlen(pv));
          break; */
        /* Uncomment this if you need to return PVNs
        case PERL_constant_ISPVN:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHp(pv, iv);
          break; */
        /* Uncomment this if you need to return SVs
        case PERL_constant_ISSV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHs(sv);
          break; */
        /* Uncomment this if you need to return UNDEFs
        case PERL_constant_ISUNDEF:
          break; */
        /* Uncomment this if you need to return UVs
        case PERL_constant_ISUV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHu((UV)iv);
          break; */
        /* Uncomment this if you need to return YESs
        case PERL_constant_ISYES:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHs(&PL_sv_yes);
          break; */
        default:
          sv = sv_2mortal(newSVpvf(
            "Unexpected return type %d while processing banking::igtplus macro %s,
used",
               type, s));
          PUSHs(sv);
        }

Makefile.PL
-----------

use 5.008001;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    NAME              => 'banking::igtplus',
    VERSION_FROM      => 'lib/banking/igtplus.pm', # finds $VERSION
    PREREQ_PM         => {}, # e.g., Module::Name => 1.1
    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
      (ABSTRACT_FROM  => 'lib/banking/igtplus.pm', # retrieve abstract from
module
       AUTHOR         => 'Jörn Knie <[EMAIL PROTECTED]>') : ()),
    LIBS              => ['-L.'], # e.g., '-lm'
    DEFINE            => '', # e.g., '-DHAVE_SOMETHING'
    INC               => '-I.', 
    OBJECT            => '$(O_FILES) libhl_api.a', # link all the C files
too
);
if  (eval {require ExtUtils::Constant; 1}) {
  # If you edit these definitions to change the constants used by this
module,
  # you will need to use the generated const-c.inc and const-xs.inc
  # files to replace their "fallback" counterparts before distributing your
  # changes.
[EMAIL PROTECTED](qw(HL_API_CALLSPEC HL_API_DECLSPEC IGT_HL_ACK_TIMEOUT
                 IGT_HL_ALL_TRACE IGT_HL_DIR_INCOM IGT_HL_DIR_OUTGO
                 IGT_HL_DISCONNECTED IGT_HL_ERR_TRACE IGT_HL_LOGIN_TIMEOUT
                 IGT_HL_MAX_PORT IGT_HL_MAX_TIMEOUT IGT_HL_MAX_TRACE
                 IGT_HL_MAX_WINDOW IGT_HL_MESSAGE_ERROR IGT_HL_MIN_ERROR
                 IGT_HL_MIN_PORT IGT_HL_MIN_TRACE IGT_HL_MIN_WINDOW
                 IGT_HL_MSG_TIMEOUT IGT_HL_MSG_TRACE IGT_HL_NAK_RECEIVED
                 IGT_HL_NOK IGT_HL_NOT_IMPLEMENTED IGT_HL_NO_CONNECTION
                 IGT_HL_NO_INIT IGT_HL_NO_MEMORY IGT_HL_NO_MSG_OPEN
                 IGT_HL_NO_TRACE IGT_HL_OK IGT_HL_OP_IN_PROGRESS
                 IGT_HL_SOCKET_ERROR IGT_HL_WRONG_ACK IGT_HL_WRONG_DIR
                 IGT_HL_WRONG_DUPL IGT_HL_WRONG_HOST IGT_HL_WRONG_IP
                 IGT_HL_WRONG_PORT IGT_HL_WRONG_ROUTE IGT_HL_WRONG_TIMEOUT
                 IGT_HL_WRONG_WINDOW));
  ExtUtils::Constant::WriteConstants(
                                     NAME         => 'banking::igtplus',
                                     NAMES        =>[EMAIL PROTECTED],
                                     DEFAULT_TYPE => 'IV',
                                     C_FILE       => 'const-c.inc',
                                     XS_FILE      => 'const-xs.inc',
                                  );

}
else {
  use File::Copy;
  use File::Spec;
  foreach my $file ('const-c.inc', 'const-xs.inc') {
    my $fallback = File::Spec->catfile('fallback', $file);
    copy ($fallback, $file) or die "Can't copy $fallback to $file: $!";
  }
}

igtplus.pm
----------

package banking::igtplus;

use 5.008001;
use strict;
use warnings;
use Carp;

require Exporter;
use AutoLoader;

our @ISA = qw(Exporter);

# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.

# This allows declaration       use banking::igtplus ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
        HL_API_CALLSPEC
        HL_API_DECLSPEC
        IGT_HL_ACK_TIMEOUT
        IGT_HL_ALL_TRACE
        IGT_HL_DIR_INCOM
        IGT_HL_DIR_OUTGO
        IGT_HL_DISCONNECTED
        IGT_HL_ERR_TRACE
        IGT_HL_LOGIN_TIMEOUT
        IGT_HL_MAX_PORT
        IGT_HL_MAX_TIMEOUT
        IGT_HL_MAX_TRACE
        IGT_HL_MAX_WINDOW
        IGT_HL_MESSAGE_ERROR
        IGT_HL_MIN_ERROR
        IGT_HL_MIN_PORT
        IGT_HL_MIN_TRACE
        IGT_HL_MIN_WINDOW
        IGT_HL_MSG_TIMEOUT
        IGT_HL_MSG_TRACE
        IGT_HL_NAK_RECEIVED
        IGT_HL_NOK
        IGT_HL_NOT_IMPLEMENTED
        IGT_HL_NO_CONNECTION
        IGT_HL_NO_INIT
        IGT_HL_NO_MEMORY
        IGT_HL_NO_MSG_OPEN
        IGT_HL_NO_TRACE
        IGT_HL_OK
        IGT_HL_OP_IN_PROGRESS
        IGT_HL_SOCKET_ERROR
        IGT_HL_WRONG_ACK
        IGT_HL_WRONG_DIR
        IGT_HL_WRONG_DUPL
        IGT_HL_WRONG_HOST
        IGT_HL_WRONG_IP
        IGT_HL_WRONG_PORT
        IGT_HL_WRONG_ROUTE
        IGT_HL_WRONG_TIMEOUT
        IGT_HL_WRONG_WINDOW
        igt_ack
        igt_end
        igt_get
        igt_init
        igt_put
        igt_test
) ] );

our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

our @EXPORT = qw(
        HL_API_CALLSPEC
        HL_API_DECLSPEC
        IGT_HL_ACK_TIMEOUT
        IGT_HL_ALL_TRACE
        IGT_HL_DIR_INCOM
        IGT_HL_DIR_OUTGO
        IGT_HL_DISCONNECTED
        IGT_HL_ERR_TRACE
        IGT_HL_LOGIN_TIMEOUT
        IGT_HL_MAX_PORT
        IGT_HL_MAX_TIMEOUT
        IGT_HL_MAX_TRACE
        IGT_HL_MAX_WINDOW
        IGT_HL_MESSAGE_ERROR
        IGT_HL_MIN_ERROR
        IGT_HL_MIN_PORT
        IGT_HL_MIN_TRACE
        IGT_HL_MIN_WINDOW
        IGT_HL_MSG_TIMEOUT
        IGT_HL_MSG_TRACE
        IGT_HL_NAK_RECEIVED
        IGT_HL_NOK
        IGT_HL_NOT_IMPLEMENTED
        IGT_HL_NO_CONNECTION
        IGT_HL_NO_INIT
        IGT_HL_NO_MEMORY
        IGT_HL_NO_MSG_OPEN
        IGT_HL_NO_TRACE
        IGT_HL_OK
        IGT_HL_OP_IN_PROGRESS
        IGT_HL_SOCKET_ERROR
        IGT_HL_WRONG_ACK
        IGT_HL_WRONG_DIR
        IGT_HL_WRONG_DUPL
        IGT_HL_WRONG_HOST
        IGT_HL_WRONG_IP
        IGT_HL_WRONG_PORT
        IGT_HL_WRONG_ROUTE
        IGT_HL_WRONG_TIMEOUT
        IGT_HL_WRONG_WINDOW
);

our $VERSION = '1.0';

sub AUTOLOAD {
    # This AUTOLOAD is used to 'autoload' constants from the constant()
    # XS function.

    my $constname;
    our $AUTOLOAD;
    ($constname = $AUTOLOAD) =~ s/.*:://;
    croak "&banking::igtplus::constant not defined" if $constname eq
'constant';
    my ($error, $val) = constant($constname);
    if ($error) { croak $error; }
    {
        no strict 'refs';
        *$AUTOLOAD = sub { $val };
    }
    goto &$AUTOLOAD;
}

require XSLoader;
XSLoader::load('banking::igtplus', $VERSION);

# Preloaded methods go here.

# Autoload methods go after =cut, and are processed by the autosplit
program.

1;
__END__
# Below is stub documentation for your module. You'd better edit it!

=head1 NAME

banking::igtplus - Perl extension for blah blah blah

=head1 SYNOPSIS

  use banking::igtplus;

=head1 DESCRIPTION

Stub documentation for banking::igtplus, created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.

Blah blah blah.

=head2 EXPORT

None by default.

=head2 Exportable constants

  HL_API_CALLSPEC
  HL_API_DECLSPEC
  IGT_HL_ACK_TIMEOUT
  IGT_HL_ALL_TRACE
  IGT_HL_DIR_INCOM
  IGT_HL_DIR_OUTGO
  IGT_HL_DISCONNECTED
  IGT_HL_ERR_TRACE
  IGT_HL_LOGIN_TIMEOUT
  IGT_HL_MAX_PORT
  IGT_HL_MAX_TIMEOUT
  IGT_HL_MAX_TRACE
  IGT_HL_MAX_WINDOW
  IGT_HL_MESSAGE_ERROR
  IGT_HL_MIN_ERROR
  IGT_HL_MIN_PORT
  IGT_HL_MIN_TRACE
  IGT_HL_MIN_WINDOW
  IGT_HL_MSG_TIMEOUT
  IGT_HL_MSG_TRACE
  IGT_HL_NAK_RECEIVED
  IGT_HL_NOK
  IGT_HL_NOT_IMPLEMENTED
  IGT_HL_NO_CONNECTION
  IGT_HL_NO_INIT
  IGT_HL_NO_MEMORY
  IGT_HL_NO_MSG_OPEN
  IGT_HL_NO_TRACE
  IGT_HL_OK
  IGT_HL_OP_IN_PROGRESS
  IGT_HL_SOCKET_ERROR
  IGT_HL_WRONG_ACK
  IGT_HL_WRONG_DIR
  IGT_HL_WRONG_DUPL
  IGT_HL_WRONG_HOST
  IGT_HL_WRONG_IP
  IGT_HL_WRONG_PORT
  IGT_HL_WRONG_ROUTE
  IGT_HL_WRONG_TIMEOUT
  IGT_HL_WRONG_WINDOW

=head2 Exportable functions

  int igt_ack(
                    int ok)
  int igt_end(
                    int direction)
  int igt_get(
                    char *msg,
                    int *len,
                    int *dupl)
  int igt_init(
                    int direction,
                    const char * host,

                    int port,
                    int timeout,
                    int window,
                    char appl,
                    int trace)
  int igt_put(
                    char *msg,
                    int len,
                    int dupl,
                    char route)
  int igt_test(
                    int dir,
                    int use_heartbt)



=head1 SEE ALSO

Mention other useful documentation such as the documentation of
related modules or operating system documentation (such as man pages
in UNIX), or any relevant external documentation such as RFCs or
standards.

If you have a mailing list set up for your module, mention it here.

If you have a web site set up for your module, mention it here.

=head1 AUTHOR

root, E<lt>[EMAIL PROTECTED]<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2004 by BKB

=cut

igtplus.xs
----------
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "ppport.h"

#include "igt_hl_api.h"

#include "const-c.inc"

MODULE = banking::igtplus               PACKAGE = banking::igtplus              

INCLUDE: const-xs.inc

int
igt_ack(ok)
        int     ok

int
igt_end(direction)
        int     direction

int
igt_get(msg, len, dupl)
        char *  msg
        int &   len
        int &   dupl

int
igt_init(direction, host, port, timeout, window, appl, trace)
        int     direction
        char * host
        int     port
        int     timeout
        int     window
        char    appl
        int     trace

int
igt_put(msg, len, dupl, route)
        char *  msg
        int     len
        int     dupl
        char    route

int
igt_test(dir, use_heartbt)
        int     dir
        int     use_heartbt



igtplus.c
---------

/*
 * This file was generated automatically by xsubpp version 1.9508 from the
 * contents of igtplus.xs. Do not edit this file, edit igtplus.xs instead.
 *
 *      ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "igtplus.xs"
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "ppport.h"

#include "igt_hl_api.h"

#include "const-c.inc"

#line 21 "igtplus.c"

/* INCLUDE:  Including 'const-xs.inc' from 'igtplus.xs' */

XS(XS_banking__igtplus_constant); /* prototype to pass -Wmissing-prototypes
*/
XS(XS_banking__igtplus_constant)
{
    dXSARGS;
    if (items != 1)
        Perl_croak(aTHX_ "Usage: banking::igtplus::constant(sv)");
    SP -= items;
    {
#line 4 "const-xs.inc"
#ifdef dXSTARG
        dXSTARG; /* Faster if we have it.  */
#else
        dTARGET;
#endif
        STRLEN          len;
        int             type;
        IV              iv;
        /* NV           nv;     Uncomment this if you need to return NVs */
        /* const char   *pv;    Uncomment this if you need to return PVs */
#line 44 "igtplus.c"
        SV *    sv = ST(0);
        const char *    s = SvPV(sv, len);
#line 18 "const-xs.inc"
        /* Change this to constant(aTHX_ s, len, &iv, &nv);
           if you need to return both NVs and IVs */
        type = constant(aTHX_ s, len, &iv);
      /* Return 1 or 2 items. First is error message, or undef if no error.
           Second, if present, is found value */
        switch (type) {
        case PERL_constant_NOTFOUND:
          sv = sv_2mortal(newSVpvf("%s is not a valid banking::igtplus
macro", s));
          PUSHs(sv);
          break;
        case PERL_constant_NOTDEF:
          sv = sv_2mortal(newSVpvf(
            "Your vendor has not defined banking::igtplus macro %s, used", s));
          PUSHs(sv);
          break;
        case PERL_constant_ISIV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHi(iv);
          break;
        /* Uncomment this if you need to return NOs
        case PERL_constant_ISNO:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHs(&PL_sv_no);
          break; */
        /* Uncomment this if you need to return NVs
        case PERL_constant_ISNV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHn(nv);
          break; */
        /* Uncomment this if you need to return PVs
        case PERL_constant_ISPV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHp(pv, strlen(pv));
          break; */
        /* Uncomment this if you need to return PVNs
        case PERL_constant_ISPVN:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHp(pv, iv);
          break; */
        /* Uncomment this if you need to return SVs
        case PERL_constant_ISSV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHs(sv);
          break; */
        /* Uncomment this if you need to return UNDEFs
        case PERL_constant_ISUNDEF:
          break; */
        /* Uncomment this if you need to return UVs
        case PERL_constant_ISUV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHu((UV)iv);
          break; */
        /* Uncomment this if you need to return YESs
        case PERL_constant_ISYES:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHs(&PL_sv_yes);
          break; */
        default:
          sv = sv_2mortal(newSVpvf(
            "Unexpected return type %d while processing banking::igtplus macro %s,
used",
               type, s));
          PUSHs(sv);
        }
#line 119 "igtplus.c"
        PUTBACK;
        return;
    }
}


/* INCLUDE: Returning to 'igtplus.xs' from 'const-xs.inc' */

XS(XS_banking__igtplus_igt_ack); /* prototype to pass -Wmissing-prototypes
*/
XS(XS_banking__igtplus_igt_ack)
{
    dXSARGS;
    if (items != 1)
        Perl_croak(aTHX_ "Usage: banking::igtplus::igt_ack(ok)");
    {
        int     ok = (int)SvIV(ST(0));
        int     RETVAL;
        dXSTARG;

        RETVAL = igt_ack(ok);
        XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_banking__igtplus_igt_end); /* prototype to pass -Wmissing-prototypes
*/
XS(XS_banking__igtplus_igt_end)
{
    dXSARGS;
    if (items != 1)
        Perl_croak(aTHX_ "Usage: banking::igtplus::igt_end(direction)");
    {
        int     direction = (int)SvIV(ST(0));
        int     RETVAL;
        dXSTARG;

        RETVAL = igt_end(direction);
        XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_banking__igtplus_igt_get); /* prototype to pass -Wmissing-prototypes
*/
XS(XS_banking__igtplus_igt_get)
{
    dXSARGS;
    if (items != 3)
        Perl_croak(aTHX_ "Usage: banking::igtplus::igt_get(msg, len, dupl)");
    {
        char *  msg = (char *)SvPV_nolen(ST(0));
        int     len = (int)SvIV(ST(1));
        int     dupl = (int)SvIV(ST(2));
        int     RETVAL;
        dXSTARG;

        RETVAL = igt_get(msg, &len, &dupl);
        XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_banking__igtplus_igt_init); /* prototype to pass -Wmissing-prototypes
*/
XS(XS_banking__igtplus_igt_init)
{
    dXSARGS;
    if (items != 7)
        Perl_croak(aTHX_ "Usage: banking::igtplus::igt_init(direction, host, port,
timeout, window, appl, trace)");
    {
        int     direction = (int)SvIV(ST(0));
        char *  host = (char *)SvPV_nolen(ST(1));
        int     port = (int)SvIV(ST(2));
        int     timeout = (int)SvIV(ST(3));
        int     window = (int)SvIV(ST(4));
        char    appl = (char)*SvPV_nolen(ST(5));
        int     trace = (int)SvIV(ST(6));
        int     RETVAL;
        dXSTARG;

        RETVAL = igt_init(direction, host, port, timeout, window, appl, trace);
        XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_banking__igtplus_igt_put); /* prototype to pass -Wmissing-prototypes
*/
XS(XS_banking__igtplus_igt_put)
{
    dXSARGS;
    if (items != 4)
        Perl_croak(aTHX_ "Usage: banking::igtplus::igt_put(msg, len, dupl,
route)");
    {
        char *  msg = (char *)SvPV_nolen(ST(0));
        int     len = (int)SvIV(ST(1));
        int     dupl = (int)SvIV(ST(2));
        char    route = (char)*SvPV_nolen(ST(3));
        int     RETVAL;
        dXSTARG;

        RETVAL = igt_put(msg, len, dupl, route);
        XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_banking__igtplus_igt_test); /* prototype to pass -Wmissing-prototypes
*/
XS(XS_banking__igtplus_igt_test)
{
    dXSARGS;
    if (items != 2)
        Perl_croak(aTHX_ "Usage: banking::igtplus::igt_test(dir, use_heartbt)");
    {
        int     dir = (int)SvIV(ST(0));
        int     use_heartbt = (int)SvIV(ST(1));
        int     RETVAL;
        dXSTARG;

        RETVAL = igt_test(dir, use_heartbt);
        XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#ifdef __cplusplus
extern "C"
#endif
XS(boot_banking__igtplus); /* prototype to pass -Wmissing-prototypes */
XS(boot_banking__igtplus)
{
    dXSARGS;
    char* file = __FILE__;

    XS_VERSION_BOOTCHECK ;

        newXS("banking::igtplus::constant", XS_banking__igtplus_constant,file);
        newXS("banking::igtplus::igt_ack", XS_banking__igtplus_igt_ack,file);
        newXS("banking::igtplus::igt_end", XS_banking__igtplus_igt_end,file);
        newXS("banking::igtplus::igt_get", XS_banking__igtplus_igt_get,file);
        newXS("banking::igtplus::igt_init", XS_banking__igtplus_igt_init,file);
        newXS("banking::igtplus::igt_put", XS_banking__igtplus_igt_put,file);
        newXS("banking::igtplus::igt_test", XS_banking__igtplus_igt_test,file);
    XSRETURN_YES;
}

Reply via email to