MUI not working with __USE_INLINE__?

13 posts / 0 new
Last post
Spirantho
Spirantho's picture
Offline
Last seen: 9 years 11 months ago
Joined: 2013-03-19 12:12
MUI not working with __USE_INLINE__?

Hi people,
I think I must be missing something obvious here as somebody must have had this problem before.

When I try and compile a very simple MUI test program, using IMUIMasterIFace and all that, it compiles and runs.
When I insert __USE_INLINE__, and remove all the interface bits, I get an error on the simple object macros.

In other words (__USE_INLINE__ not defined):

  1. IMUIMaster->PopaslObject, End;

works.
But this (when __USE_INLINE__ is defined):

  1. PopaslObject, End;

does not work. Instead I get:

  1. error: unterminated argument list invoking macro "MUI_NewObject"
  2. main.c: In Function 'main':
  3. main.c:17: error: 'MUI_NewObject' undeclared (first use in this function)
  4. main.c:17: error: expected ';' at end of input
  5. main.c:17: error: expected declaration or statement at end of input

I'm sure it's something silly I've missed but I can't find a solution. Can someone point me to the relevant FAQ please? :)

Thanks!

kas1e
kas1e's picture
Offline
Last seen: 1 year 5 months ago
Joined: 2010-11-30 15:30
@Spiranto Dunno about that

@Spiranto
Dunno about that case exactly, but when i use __USE_INLINE__, all i should do its only open muimaster.library and IFACE anyway (but all mui functions of course used without iface bits). It can be something with includes like you include only libraries/muimaster.h , or only proto/muimaster or both

Spirantho
Spirantho's picture
Offline
Last seen: 9 years 11 months ago
Joined: 2013-03-19 12:12
Thanks kas1e. That's what I

Thanks kas1e. That's what I thought, too, but it changes the macros for the simple object creation and gets very confused. I think it's because MUI_NewObject is #defined as a macro when you use __USE_INLINE__ and then when you do a simple object creation like "PopaslObject" then it expands it to MUI_NewObject, and then expands that to something else.

I'm including
and
as normal (tried including in different order - no change)

This problem is making it incredibly difficult to port an app which is multi-(Amiga-)platform and uses MUI!

kas1e
kas1e's picture
Offline
Last seen: 1 year 5 months ago
Joined: 2010-11-30 15:30
@Spiranto This problem is

@Spiranto


This problem is making it incredibly difficult to port an app which is multi-(Amiga-)platform and uses MUI!

__USE_INLINE__ of course works with mui apps (that how i port odyssey, mui mplayer, lunapaint, zunefig and all other stuff) , just there can be something wrong somewhere else. Can you please upload ready-to-compile simple test case, so i can have a go with it, and if there is indeed bug in SDK we can report it to be fixed.

Spirantho
Spirantho's picture
Offline
Last seen: 9 years 11 months ago
Joined: 2013-03-19 12:12
Thanks kas1e, This is the

Thanks kas1e,

This is the code that doesn't work:

  1. #include <stdio.h>
  2.  
  3. #define __USE_INLINE__
  4.  
  5. #include <proto/exec.h>
  6. #include <libraries/mui.h>
  7. #include <proto/muimaster.h>
  8.  
  9. struct MUIMasterIFace *IMUIMaster = NULL;
  10. struct Library *MUIMasterBase = NULL;
  11.  
  12. int main( int argc, char *argv[] )
  13. {
  14. MUIMasterBase = /*IExec->*/OpenLibrary( "muimaster.library", 0L );
  15. IMUIMaster = (struct MUIMasterIFace *)/*IExec->*/GetInterface( MUIMasterBase, "main", 1L, TAG_END );
  16. printf( "IMUIMaster: %p\n", IMUIMaster );
  17. /*IMUIMaster->*/PopaslObject, End;
  18.  
  19. if ( IMUIMaster != NULL )
  20. {
  21. /*IExec->*/DropInterface( (struct Interface *)IMUIMaster );
  22. }
  23. if ( MUIMasterBase != NULL )
  24. {
  25. /*IExec->*/CloseLibrary( MUIMasterBase );
  26. }
  27.  
  28. }

Removing the __USE_INLINE__ and re-enabling the IExec-> etc. makes it work. I've tried PopaslObject with and without the interface.

Thanks!

zzd10h
zzd10h's picture
Offline
Last seen: 6 years 4 months ago
Joined: 2012-08-24 20:56
For me, no problem with MUI

For me, no problem with MUI and _USE_INLINE__.

Take a look at this very simple and compilable sample. Maybe that you will find where you failed.

http://zzd10h.amiga-ng.org/Divers/MUI/TestMUI_Spirantho.lha

Bye

Spirantho
Spirantho's picture
Offline
Last seen: 9 years 11 months ago
Joined: 2013-03-19 12:12
Thanks for that, but it's the

Thanks for that, but it's the same...

  1. 7.RAM Disk:TestMUI_Spirantho> make
  2. SDK:gcc/bin/gcc -c test.c -o test.o -I. -I/sdk/MUI/C/Include -Wall -Wwrite-strings -D__USE_INLINE__ -D__USE_BASETYPE__
  3. test.c:127:1: error: unterminated argument list invoking macro "MUI_NewObject"
  4. test.c: In function 'CreateGui':
  5. test.c:67: error: 'MUI_NewObject' undeclared (first use in this function)
  6. test.c:67: error: (Each undeclared identifier is reported only once
  7. test.c:67: error: for each function it appears in.)
  8. test.c:67: error: expected ';' at end of input
  9. test.c:67: error: expected declaration or statement at end of input
  10. make: *** [test.o] Error 1

This is with a clean installation of the SDK, by the way.
Very confused now.

zzd10h
zzd10h's picture
Offline
Last seen: 6 years 4 months ago
Joined: 2012-08-24 20:56
Ah, ok, me I still use the

Ah, ok, me I still use the previous MUI 3.9 SDK.

I have the same error than you when I use the new MUI 4 SDK.

Except if I add
#define MUI_NewObject IMUIMaster->MUI_NewObject
to my test.c.

I know it's bad and don't resolve your problem.

I will keep my MUI3.9 SDK...until you find a way to solve your SDK ;)

kas1e
kas1e's picture
Offline
Last seen: 1 year 5 months ago
Joined: 2010-11-30 15:30
@Spirantho Maybe in some

@Spirantho

Maybe in some fresh mui4-sdk updates something was broken (as i use some previous versions of SDK for mui4 and it was ok, but also fail on new one as for you). I already send report to Thore, so imho we need just wait a bit and all will be fixed.

Spirantho
Spirantho's picture
Offline
Last seen: 9 years 11 months ago
Joined: 2013-03-19 12:12
Do we know if this is being

Do we know if this is being looked at at the moment? If it's being fixed then I'll hold off on my porting, but if it's not I'll have to go back to the MUI 3 SDK, which I'd rather not do if I can help it...

Thanks again for your help!

gazelle
gazelle's picture
Offline
Last seen: 1 year 1 month ago
Joined: 2011-04-13 12:52
Just replace in

Just replace in SDK:MUI/C/include/inline4/muimaster.h

  1. #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3)
  2. #define MUI_NewObject(...) IMUIMaster->MUI_NewObject(__VA_ARGS__)
  3. #elif (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
  4. #define MUI_NewObject(vargs...) IMUIMaster->MUI_NewObject(## vargs)
  5. #endif

with
#define MUI_NewObject IMUIMaster->MUI_NewObject

That's how YAM is doing it.

kas1e
kas1e's picture
Offline
Last seen: 1 year 5 months ago
Joined: 2010-11-30 15:30
@Spirantho Yes, it was fixed

@Spirantho
Yes, it was fixed (today) and will avail in next update (will put more details tomorrow, but i assume its something like gazelle says).

kas1e
kas1e's picture
Offline
Last seen: 1 year 5 months ago
Joined: 2010-11-30 15:30
@Spirantho Yep, checked the

@Spirantho
Yep, checked the fix, and its right as Gazelle says 1:1

Log in or register to post comments