MOS: SetPointer conflict : intuition.h vs hollywood/plugin.h

Discuss questions about plugin development with the Hollywood SDK here
Post Reply
p-OS
Posts: 89
Joined: Tue Nov 02, 2010 12:56 am

MOS: SetPointer conflict : intuition.h vs hollywood/plugin.h

Post by p-OS » Tue Apr 11, 2017 1:47 am

SDK 6.1 library plugin example: when I add the following lines to either amigaentry.c and/or testplugin.c :

Code: Select all

#include <proto/intuition.h> 
#include <intuition/intuition.h> 
before this line:

Code: Select all

#include <hollywood/plugin.h> 

I get this error from gcc (no matter if gcc 2.9 or gcc 5) :

Code: Select all

Work:Hollywood/SDK/examples/library> make -f makefile.mos testplugin
gcc -o build/mos/amigaentry.o -c -DHW_AMIGA -DHW_MORPHOS -O2 -Wall -Wno-pointer-sign -noixemul -I../../include src/amigaentry.c
In file included from src/amigaentry.c:15:0:
../../include/hollywood/plugin.h:2035:59: error: macro "SetPointer" requires 6 arguments, but only 3 given
 HW_EXPORT void SetPointer(APTR handle, int type, APTR data);
                                                           ^
../../include/hollywood/plugin.h:2035:16: error: 'SetPointer' redeclared as different kind of symbol
 HW_EXPORT void SetPointer(APTR handle, int type, APTR data);
                ^
In file included from /gg/os-include/proto/intuition.h:14:0,
                 from src/amigaentry.c:10:
/gg/os-include/clib/intuition_protos.h:71:6: note: previous declaration of 'SetPointer' was here
 VOID SetPointer( struct Window *window, UWORD *pointer, LONG height, LONG width, LONG xOffset, LONG yOffset );
      ^
make: *** [build/mos/amigaentry.o] Error 1
Work:Hollywood/SDK/examples/library>
My temporary solution was commenting out this line in hollywood/plugin.h:

Code: Select all

HW_EXPORT void SetPointer(APTR handle, int type, APTR data);

User avatar
airsoftsoftwair
Posts: 2537
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: MOS: SetPointer conflict : intuition.h vs hollywood/plug

Post by airsoftsoftwair » Tue Apr 11, 2017 11:52 am

Yes, unfortunately, some Hollywood plugin APIs clash with OS APIs, not only on Amiga but also on Windows. I really should've used a prefix like "hwp" or something to avoid that, but that's too late now. But there's a workaround in plugin.h without needing you to manipulate it: You can just define the macro HW_PLUGIN_NOPROTOS and the SDK will skip these prototypes, i.e.

Code: Select all

#define HW_PLUGIN_NOPROTOS
#include <hollywood/plugin.h>

p-OS
Posts: 89
Joined: Tue Nov 02, 2010 12:56 am

Re: MOS: SetPointer conflict : intuition.h vs hollywood/plug

Post by p-OS » Wed Apr 12, 2017 1:34 am

Your suggestion results in:

Code: Select all

src/amigaentry.c:49:26: error: 'InitPlugin' undeclared here (not in a function)
  {"InitPlugin", (void *) InitPlugin},
                          ^
src/amigaentry.c:50:27: error: 'ClosePlugin' undeclared here (not in a function)
  {"ClosePlugin", (void *) ClosePlugin},
                           ^
src/amigaentry.c:51:28: error: 'GetBaseTable' undeclared here (not in a function)
  {"GetBaseTable", (void *) GetBaseTable},
                            ^
src/amigaentry.c:52:27: error: 'GetCommands' undeclared here (not in a function)
  {"GetCommands", (void *) GetCommands},
                           ^
src/amigaentry.c:53:28: error: 'GetConstants' undeclared here (not in a function)
  {"GetConstants", (void *) GetConstants},
                            ^
src/amigaentry.c:54:27: error: 'InitLibrary' undeclared here (not in a function)
  {"InitLibrary", (void *) InitLibrary},
                           ^
src/amigaentry.c:55:27: error: 'FreeLibrary' undeclared here (not in a function)
  {"FreeLibrary", (void *) FreeLibrary},
                           ^
make: *** [build/mos/amigaentry.o] Error 1
Thus I removed the suggested line again. Instead of commenting out the

Code: Select all

HW_EXPORT void SetPointer(APTR handle, int type, APTR data);
I renamed it to:

Code: Select all

HW_EXPORT void hw_SetPointer(APTR handle, int type, APTR data);

For the (unlikely) case I one day might want to write my own display adapter plugin I would export my functions this was:

Code: Select all

static const struct
{
	STRPTR name;
	void *func;
} funcs[] =
{
	{...},
	{"FreePointer", (void *) FreePointer},
	{"SetPointer", (void *) hw_SetPointer},
	{"ShowHidePointer", (void *) ShowHidePointer},
	{...},	
	{NULL, NULL}
};                          

User avatar
airsoftsoftwair
Posts: 2537
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: MOS: SetPointer conflict : intuition.h vs hollywood/plug

Post by airsoftsoftwair » Wed Apr 12, 2017 11:14 am

Yes, that's a feasible workaround. If you don't want to hack the includes, just place the symbol lookup table in a source file of its own that doesn't include any OS prototypes. Then you should be fine.

Post Reply