Path: utzoo!attcan!uunet!cbmvax!bj From: bj@cbmvax.commodore.com (Brian Jackson) Newsgroups: comp.sys.amiga.tech Subject: Re: Problem with OpenLibrary() under 2.0 Message-ID: <16447@cbmvax.commodore.com> Date: 11 Dec 90 15:16:32 GMT References: <9012101903.AA146539@vttcf.cc.vt.edu> Reply-To: bj@cbmvax.commodore.com (Brian Jackson) Organization: Commodore, West Chester, PA Lines: 36 In article nj@magnolia.Berkeley.EDU (Narciso Jaramillo) writes: >In article <9012101903.AA146539@vttcf.cc.vt.edu> fmcphers@VTTCF.CC.VT.EDU (Frank McPherson) writes: > >> [...] >> void OpenLibrary(); > ^^^^ >> if (!(IntuitionBase = (struct IntuitionBase *) >> OpenLibrary("intuition.library"))) >> [...] > >> Manx 5.0d tells me that there's an invalid type conversion >> in the if statement, right on the second close paren after the actual >> OpenLibrary() call. > >You're declaring OpenLibrary() as void, then using its return value--strictly >a no-no. It should be declared as struct Library *OpenLibrary(). Also, you >should put the 0L back in the call to OpenLibrary. > Well, yes and no. It should be void *OpenLibrary() ; /* a pointer to void */ This is ok as void pointers can be cast to/from other types (see page 199 of the ANSI K&R) Manx 5.0 now defaults to 32-bits so the 0L is not required any more (though still a good idea) - a simple '0' will do. bj >nj ----------------------------------------------------------------------- | Brian Jackson Software Engineer, Commodore-Amiga Inc. GEnie: B.J. | | bj@cbmvax.cbm.commodore.com or ...{uunet|rutgers}!cbmvax!bj | -----------------------------------------------------------------------