[osg-users] REGISTER_WINDOWINGSYSTEMINTERFACE() breaks build

John Hughes johughes at teslamotors.com
Wed May 18 14:52:42 PDT 2016


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








More information about the osg-users mailing list