🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #13606

#pragma/Read(), why does this break?

#13606
From: Steve Koren
Date: Thu, 08 Feb 1990 23:54
52 lines
1783 bytes
Here's one for all you folks intimately familiar with the Amiga I/O
functions.  I have a little program that looks like this:

#include <proto/all.h>
#include <libraries/dos.h>
#include <libraries/dosextens.h>
#include <ctype.h>

#define BUFF_SIZE 4096

unsigned char buff[BUFF_SIZE];

short main(argc, argv)

    short argc;
    char  *argv[];
{
    struct FileHandle  *in_fh;
    short x,
          return_code,
          start = 1;

    for (x=start; x<argc; x++) {
        if ((in_fh = (struct FileHandle *)
                     Open(argv[x], MODE_OLDFILE)) == NULL) {

            exit(1);
        } else {
            Read((BPTR)in_fh, buff, BUFF_SIZE);
            Close((BPTR)in_fh);
        }
    }
}

It could probably be simplified further, but I didn't bother.  Anyhow, it
works just great if I 1) comment out the proto/all.h line and 2) link with
amiga.lib.  However, if I include the proto/all.h file, and link with
only lc.lib like this:

blink from lib:cres.o fail5.o to ram:fail5 lib lib:lc.lib

the resulting executable guru's every time at the Read() line.  I have
tried allocating the buffer with AllocMem to get  4-byte boundry 
alignment, but that didn't seem to matter.

I also have found that any attempts to link with DEFINE __main=__tinymain
will crash when a Read() is encountered using the #pragma.

Anyone know what gives?

       - steve
Technical Details
Message-ID: <13920043@hpfelg.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcso!hpfelg!koren

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcso!hpfelg!koren
From: koren@hpfelg.HP.COM (Steve Koren)
Newsgroups: comp.sys.amiga.tech
Subject: #pragma/Read(), why does this break?
Message-ID: <13920043@hpfelg.HP.COM>
Date: 8 Feb 90 23:54:15 GMT
Organization: HP Elec. Design Div. -FtCollins
Lines: 52