Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ulowell!cbmvax!higgin From: higgin@cbmvax.UUCP (Paul Higginbottom MKT) Newsgroups: comp.sys.amiga Subject: Re: trouble opening intuition.library Message-ID: <5347@cbmvax.UUCP> Date: 29 Nov 88 20:49:52 GMT References: <5679@louie.udel.EDU> Reply-To: higgin@cbmvax.UUCP (Paul Higginbottom MKT) Organization: Commodore Technology, West Chester, PA Lines: 47 In article <5679@louie.udel.EDU> mermelstein%tel.inrs.cdn@relay.ubc.ca (lois mermelstein) writes: $Help -- I'm having serious trouble opening the intuition.library (so I can $open windows onto Workbench, etc.) $I'm using code like: $ $struct IntuitionBase *IntuitionBase; $#define INTUITION_REV /*either 33, 0, 33L, or 0L */ $ $main() ${ $IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", $ INTUITION_REV); $if (IntuitionBase == NULL) ${ printf("Couldn't open lib.\n"); $ exit() $} $ $When the constant INUITION_REV is set to 33 or 0, I simply get "Couldn't open $lib." from the printf. When I set it to 33L or 0L, I get "software error -- $task held", with a guru number of "#0000000A.00C [plus some other numbers]. $ $I'm using Manx 3.6A with the default c.lib (16 bit ints) on a 2-floppy $B2000 that's completely vanilla (nothing else running, nothing bizarre $in the startup-sequence). $... $Any ideas? Any help would be mucho appreciated. $ $Lois Mermelstein $mermelstein@tel.inrs.cdn Are you declaring OpenLibrary as returning a pointer? If you don't, Manx (and most compilers) will assume it returns an int, in this case, a 16 bit int. When that is cast (as you declared it), it will be extended from 16 bits to 32 bits, which is trashing what was a perfectly good return value. Long winded explanation, but here's the solution: Add this to the top of your source file someplace: extern void *OpenLibrary(); (or perhaps) extern struct Library *OpenLibrary(); Regards, Paul.