Help! Compiling Perl with user subroutines 
Author Message
 Help! Compiling Perl with user subroutines

I'm trying to compile a custom version of Perl under MSDOS (OK, OK) so I
can link in
a set of database routines.  I do not know what I may be doing wrong, but
the result  
is . . . nothing.  Perl compiles and it seems to work, but it doesn't
recognize the new  
functions that I'm trying to link in.  That is, when I try to run perl with
scripts containing
the new functions, perl gives a compile error.

What I've done is create a new usersub.c and link with the database

usersub.c looks like this:

#include <windows.h>
#include <string.h>
#include <stdio.h>
#include "EXTERN.h"
#include "perl.h"
#include "dbu.h"     // header file needed for the database package

char *savestr();

static int  
static int usersub();
static int init_tm1(void);

static enum usersubs {


   return 0;


static int init_db()
struct ufuncs uf;
char *filename = "usersub.c";

        printf("%s","Starting . . .\n");    // Just to make sure we actually reach
here (we do)
        make_usub("db_dsave", US_DB_DSAVE, usersub, filename);
        return 0;


static int usersub(ix, sp, items)
int ix;
register int sp;
register int items;
        STR **st = stack->ary_array + sp ;
        register int i;
        register char *tmps;
        register STR *Str;

 switch (ix) {

// Output from db.mus

    case US_DB_DSAVE:
        if (items != 1)
            fatal("Usage: &DB_DSAVE($str)");
        else {
            int retval;
            char*       str =           (char*)         str_get(st[1]);

            retval = DB_DSAVE(str);
            str_numset(st[0], (double) retval);
        return sp;
return 0;


Any help would be SOOO appreciated.

David Friedlander
voice 212-942-1156    fax 212-569-8680

Mon, 18 Aug 1997 19:34:40 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Help: strict compile-time check of subroutine's existance

2. problems compiling a new subroutine into perl

3. Help - Subroutine within a Subroutine Illegal?

4. Writing User Subroutines in C for 4.036

5. User Defined Subroutines.

6. Memory Leak? - Problem of Calling User-Defined Subroutines

7. running a subroutine as a different user

8. Docs for user subroutine facility?

9. Subroutines in an eval'ed user-script

10. "Demand-Compiling" Subroutines

11. Compiling regexes for the duration of a subroutine

12. Error 1 while compiling as user on BSDi


Powered by phpBB® Forum Software