Welcome, Guest. Please login or register.

Author Topic: Help with OpenLibrary()  (Read 4045 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline jonssonjTopic starter

  • Sr. Member
  • ****
  • Join Date: Oct 2003
  • Posts: 254
    • Show all replies
Help with OpenLibrary()
« on: March 07, 2004, 12:19:14 PM »
Hello!

Im reading my RKRM Libraries manual and Im trying to do the first sample, that uses the DisplayBeep() function.

Im using Storm C V4 GUI but with the Storm C V3 Compiler.

My program looks like this:

#include
#include

/* Get storage for the library base. The base Name must be IntuitionBase */
struct IntuitionBase *IntuitionBase;

int main()
{
 IntuitionBase = (struct IntuitionBase *) OpenLibrary("Intuition.library", 33L);
 if (IntuitionBase) {
  DisplayBeep(0L);
  CloseLibrary(IntuitionBase);
 } else {
  exit(20);
 }  
}

When I try to compile this program I get the following error

Error: In function `int main()´:
    type `Library´ is not a base type for type `IntuitionBase´
OpenLib.cpp Line 11

Can someone tell what the heck is going on?

Its frustrating to get stuck on the first example... :)

/Jörgen
 

Offline jonssonjTopic starter

  • Sr. Member
  • ****
  • Join Date: Oct 2003
  • Posts: 254
    • Show all replies
Re: Help with OpenLibrary()
« Reply #1 on: March 08, 2004, 07:01:14 AM »
Thanks to all of you, for all your replys.

@Jettah
My intention is not to draw the user's attention this way. I'm only doing the sample program in the RKRM Library manual. But thanks for the point...   :-)  About the layout of my program, I did not know that the spaces disappeared in the message when pressing the submit button. All my programs that I write are usually indented.

@Piru
I saw that you includes a lot more header files. Is this really neccessary? I thought your example was a bit complicated just to show the use of DisplayBeep.

Anyway, thanks to you all for the help.

/Jörgen
 

Offline jonssonjTopic starter

  • Sr. Member
  • ****
  • Join Date: Oct 2003
  • Posts: 254
    • Show all replies
Re: Help with OpenLibrary()
« Reply #2 on: March 08, 2004, 09:08:55 AM »
@Piru
Thanks a lot for your help. :-) I appreciate it a lot. One more thing though, why do you call exit "an un-amiga call"? It is used in the RKRM Libraries manual.

/Jörgen
 

Offline jonssonjTopic starter

  • Sr. Member
  • ****
  • Join Date: Oct 2003
  • Posts: 254
    • Show all replies
Re: Help with OpenLibrary()
« Reply #3 on: March 08, 2004, 05:58:47 PM »
Ok, thanks!

Now I am on my amiga at home and I have right now tryed your example. The code compiles and links ok, but when I run the program, I can´t see anything that flashes and I can´t hear any beep either.

When I debug the program, it seems like it calls the function DisplayBeep(NULL);

What is wrong?

One more question, How do I add variables to the storm C V4 watch window, when I debug a program?

/Jörgen
 

Offline jonssonjTopic starter

  • Sr. Member
  • ****
  • Join Date: Oct 2003
  • Posts: 254
    • Show all replies
Re: Help with OpenLibrary()
« Reply #4 on: March 09, 2004, 09:51:47 AM »
I will check that out when I get home tonight.

Is there anyone out there with more suggestions?

/Jörgen
 

Offline jonssonjTopic starter

  • Sr. Member
  • ****
  • Join Date: Oct 2003
  • Posts: 254
    • Show all replies
Re: Help with OpenLibrary()
« Reply #5 on: March 09, 2004, 11:54:06 AM »
Aha, that's the thing then...   But as you said I should hear the beep.

Where does this beep sound come from? is it played through AHI or is it output through the Amigas RCA connectors on the back?

/Jörgen