[osg-users] REGISTER_WINDOWINGSYSTEMINTERFACE() breaks build

Robert Osfield robert.osfield at gmail.com
Fri May 20 01:52:03 PDT 2016


Hi John,

Sorry to hear things have broken.  I had to make the changes to Apple
side without being able to test it.  I have been able to test under
Linux and Windows and haven't seen build problems, but... if we look
at the usage it's slightly different - X11 and Win32 I don't specify a
namespace at all:

GraphicsWindowCarbon.cpp:REGISTER_WINDOWINGSYSTEMINTERFACE(Carbon,
osgViewer::CarbonWindowingSystemInterface)
GraphicsWindowCocoa.mm:REGISTER_WINDOWINGSYSTEMINTERFACE(Cocoa,
osgViewer::CocoaWindowingSystemInterface)
GraphicsWindowIOS.mm:REGISTER_WINDOWINGSYSTEMINTERFACE(IOS,
osgViewer::ConcreteIOSWindowingSystemInterface)
GraphicsWindowWin32.cpp:REGISTER_WINDOWINGSYSTEMINTERFACE(Win32,
Win32WindowingSystem)
GraphicsWindowX11.cpp:REGISTER_WINDOWINGSYSTEMINTERFACE(X11,
X11WindowingSystemInterface)

What happens if you just remove the namespace under Apple?  If this
doesn't work and the namespace is required then perhaps adding a
namespace osgViewer {} around the REGISTER_WINDOWINGSYSTEMINTERFACE
would be sufficient.

The reason why I suggest this approach is that if we add a namespace
parameter into the macro as you suggest then we'll need to make sure
the Win32 and X11 interfaces are placed within a namespace.  Not
necessarily a bad thing bit just a bit more intrusive than removing a
namespace:: from the macro under Apple.

Could you test this and let me know.

Robert.

On 18 May 2016 at 22:52, John Hughes <johughes at teslamotors.com> wrote:
> Hi folks,
>
> In commit fe6238, a macro was added to osg/GraphicsContext:
>
>
> Code:
> #define REGISTER_WINDOWINGSYSTEMINTERFACE(ext, classname) \
> extern "C" void graphicswindow_##ext(void) {} \
> static osg::WindowingSystemInterfaceProxy<classname> s_proxy_##classname(#ext);
>
>
>
> This unfortunately doesn’t quite work as intended in some of the osgViewer/GraphicsWindow* implementation classes:
>
> GraphicsWindowCocoa.mm,
> GraphicsWindowIOS.mm,
> GraphicsWindowCarbon.cpp
>
> For example in GraphicsWindowCocoa, the macro is invoked as follows:
>
>
> Code:
> REGISTER_WINDOWINGSYSTEMINTERFACE(Cocoa, osgViewer::CocoaWindowingSystemInterface)
>
>
>
> However the "osgViewer::CocoaWindowingSystemInterface” is viewed as 3 separate tokens by the preprocessor, and so replaces “##classname” with only “osg”.
>
> Here is a proposed work-around:
>
>
> Code:
> #define REGISTER_WINDOWINGSYSTEMINTERFACE(ext, ns, classname) \
> extern "C" void graphicswindow_##ext(void) {} \
> static osg::WindowingSystemInterfaceProxy<ns::classname> s_proxy_##classname(#ext);
>
>
>
>
>
>>
>
> Code:
>
> REGISTER_WINDOWINGSYSTEMINTERFACE(Cocoa, osgViewer, CocoaWindowingSystemInterface)
>
>
>
>
> regards,
> John
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=67147#67147
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list