Help needed with TimedDosRequester function

6 posts / 0 new
Last post
jap
jap's picture
Offline
Last seen: 9 months 3 weeks ago
Joined: 2011-06-04 05:53
Help needed with TimedDosRequester function

Hi,

I'm trying to use DOS library function TimedDosRequesterTags() to display error messages. I'm obviously doing something wrong because the function call causes Guru Meditation 80000003. I have no idea why that happens. Can anyone give a working example?

My call is as follows:

  1. nDummy = IDOS->TimedDosRequesterTags (
  2. TDR_TitleString, ( STRPTR ) MSG_REQ_TITLE,
  3. TDR_GadgetString, ( STRPTR ) MSG_REQ_OK,
  4. TDR_FormatString, ( STRPTR ) szMessage,
  5. TDR_ImageType, TDRIMAGE_ERROR,
  6. TAG_DONE );
thomas
thomas's picture
Offline
Last seen: 3 months 2 weeks ago
Joined: 2011-05-16 14:23
This piece of code is far too

This piece of code is far too short to tell anything.

Let's collect possible reasons:

- IDOS is not initialized
- MSG_REQ_TITLE, MSG_REG_OK or szMessage are not valid string pointers
- szMessage contains format specifiers but you don't supply an ArgArray
- someting else in an other part of your program

jap
jap's picture
Offline
Last seen: 9 months 3 weeks ago
Joined: 2011-06-04 05:53
MSG_REQ_TITLE and MSG_REQ_OK

MSG_REQ_TITLE and MSG_REQ_OK are defines:

  1. #define MSG_REQ_TITLE "My application"
  2. #define MSG_REQ_OK "_OK"

The TimedDosRequesterTags call is inside the following function:

  1. void DisplayMessage ( STRPTR szMessage )
  2. {
  3. int32 nDummy;
  4.  
  5. nDummy = IDOS->TimedDosRequesterTags (
  6. TDR_TitleString, ( STRPTR ) MSG_REQ_TITLE,
  7. TDR_GadgetString, ( STRPTR ) MSG_REQ_OK,
  8. TDR_FormatString, ( STRPTR ) szMessage,
  9. TDR_ImageType, TDRIMAGE_ERROR,
  10. TAG_DONE );
  11. }

In the main program I make a DisplayMessage function call which summons the Guru:
DisplayMessage ( "out of memory" );

If I ignore the Guru Meditation (DSI error) with Grim Reaper, the requester opens and it looks OK.

jabirulo
jabirulo's picture
Offline
Last seen: 4 weeks 1 day ago
Joined: 2013-05-30 00:53
Are you sure is te requester

Are you sure is te requester is the cause of the DSI?
You can try to add -gstabs in link/compile and the see what line is causing the error.
Using hardcoded strings, make it DSI too?
Or if you change DisplayMessage() with a simple 'Printf("out of memory\n")'?

  1. ;/*
  2. gcc -N -Wall -o TimedDosRequester TimedDosRequester.c -lauto
  3. quit
  4. */
  5. #include <proto/dos.h>
  6.  
  7. #define MSG_REQ_TITLE "My application"
  8. #define MSG_REQ_OK "_OK"
  9.  
  10.  
  11. int main(void)
  12. {
  13. STRPTR szMessage = "out of memory";
  14. int32 nDummy;
  15.  
  16. nDummy = IDOS->TimedDosRequesterTags(TDR_TitleString, (STRPTR)MSG_REQ_TITLE,
  17. TDR_GadgetString, (STRPTR)MSG_REQ_OK,
  18. TDR_FormatString, (STRPTR)szMessage,
  19. TDR_ImageType, TDRIMAGE_ERROR,
  20. TDR_Timeout, 4,
  21. TAG_DONE);
  22. return(0);
  23. }

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

jap
jap's picture
Offline
Last seen: 9 months 3 weeks ago
Joined: 2011-06-04 05:53
I found the bug! There was

I found the bug!

There was one line left of the old code in the DisplayMessage function which was not commented away. It caused the DSI error. Once I commented the line, error was gone.

hypex
hypex's picture
Offline
Last seen: 4 months 1 day ago
Joined: 2011-09-09 16:20
So, what was the line? :-)

So, what was the line? :-)

Log in or register to post comments