[comp.unix.aux] SF package fails under A/UX 2.0.1

tony@tui.marcam.dsir.govt.nz (Tony Cooper) (05/02/91)

I wrote a simple program to read a file. The program works fine under both
MacOS and A/UX using Think C. But I have spent two days trying to get it to
work using the cc compiler and it doesn't properly. Here's the code:
    {
        Point           where;
        short           numTypes;
        SFReply         reply;
        SFTypeList      typeList;
        char            *prompt;

        where.h = 50;
        where.v = 50;
        numTypes = -1;
        prompt = "";

        sfgetfile(where, prompt, nil, numTypes, typeList, nil, &reply);
    }
I inserted it as is into sample.c just after the initializations. Since I
used sample.c (in /mac/src) the rest of the program should be correct.

Under mac32 from commandshell I type sample and the program works. Good.
But when I run it by double clicking, it crashes due to trying to execute
code at 0000000A (which isn't a good place to try executing code). The
SF dialog is briefly displayed with some files listed before the crash.

Looks like something is not initialised properly (null pointer) when
launched by double clicking, but is OK when launched from the UNIX 
command line. The behaviour is the same whether I use shared libraries
or not. Apart from the above lines, everything else is the same as for
the sample program.

Anyone any idea what's going on?

Thanks,
Tony Cooper
sramtrc@albert.dsir.govt.nz

tony@tui.marcam.dsir.govt.nz (Tony Cooper) (05/06/91)

Thanks to those people who responded to my programming problem with
SFGetFile. Suggestions such as calling InitAllPacks and allocating 256
characters for the prompt string did not work.

The problem is still unresolved. I suspect that the problem lies with 
a bug in something in A/UX. But at this stage I do not have the time
to persue it any further. I have posted the code in another news
posting to this newsgroup where the bug isn't really important. It's
only a demo program anyway.

Tony Cooper