🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problem with OpenLibrary() under 2.0

#7359
From: Brian Jackson
Date: Mon, 10 Dec 1990 22:53
56 lines
2455 bytes
In article <9012101903.AA146539@vttcf.cc.vt.edu> fmcphers@VTTCF.CC.VT.EDU (Frank McPherson) writes:
>
>I'm trying to play around with windows and such.  I've encountered an error
>I can't figure out.
>
>#include <exec/types.h>             
>#include <intuition/intuition.h>    
>struct IntuitionBase *IntuitionBase;
>void OpenLibrary();                            
>if (!(IntuitionBase = (struct IntuitionBase *) 
>   OpenLibrary("intuition.library")))            
> {                                             
> printf("Could not open intuition.library.\n");
> close_junk();                                 
> exit(FALSE);                                  
> }

>This ain't working.  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.  I thought maybe it was that I was passing it an old 
>version number (I was passing 0L as the version number right after the first
>arguement), but taking it out didn't make a bit of difference.  What am I 
>missing?
>Thanks,

You're missing the version number, as you mentioned, and the file
"functions.h" which tells the compiler a lot of things it needs to be
happy. This works:

#include<exec/types.h>
#include<intuition/intuition.h>
#include<functions.h>           /* Manx smiles on this file :) */

struct IntuitionBase *IntuitionBase ;

void main(void)
{
	if(IntuitionBase = OpenLibrary("intuition.library", 0L ))
	{
		printf("success\n") ;
		CloseLibrary( IntuitionBase ) ;
	}
	else
	{
		printf("failure\n") ;
	}
}

bj
		
>-- Frank McPherson                  INTERNET: fmcphers@vttcf.cc.vt.edu --

 -----------------------------------------------------------------------
 | Brian Jackson  Software Engineer, Commodore-Amiga Inc.  GEmie: B.J. |
 | bj@cbmvax.cbm.commodore.com    or  ...{uunet|rutgers}!cbmvax!bj     |
 |---------------------------------------------------------------------|
Technical Details
Message-ID: <16426@cbmvax.commodore.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!rutgers!bagate!cbmvax!bj
References: <9012101903.AA146539@vttcf.cc.vt.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!rutgers!bagate!cbmvax!bj
From: bj@cbmvax.commodore.com (Brian Jackson)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Problem with OpenLibrary() under 2.0
Message-ID: <16426@cbmvax.commodore.com>
Date: 10 Dec 90 22:53:38 GMT
References: <9012101903.AA146539@vttcf.cc.vt.edu>
Reply-To: bj@cbmvax.commodore.com (Brian Jackson)
Organization: Commodore, West Chester, PA
Lines: 56