Many Thanks Larry, 

I spoke with the rest of my team and they agree we should patch it in our 
plugins after #include <maya/M3dView.h> instead of patching oiio directly. 

Appreciate the advice! 

From: "Larry Gritz" <l...@larrygritz.com> 
To: "oiio-dev" <oiio-dev@lists.openimageio.org> 
Sent: Thursday, 9 July, 2020 1:47:25 PM 
Subject: Re: [Oiio-dev] oiio/2.1.17 typedesc.h compatibility with Maya2019 / 
libx11 (small issue) 

Yeah, I've seen things like that pop up a couple of times before. 

I think your solution is fine. I'm happy to add that if it's the best or only 
approach. 

Not trying to pass the buck here, but it kind of seems odd for typedesc.h (or 
any header) to have to defensively check that some prior badly behaved header 
may have defined a macro with the name of a symbol that we use (and that we 
define safely -- as an enum, and in a namespace). 

Maybe the responsibility is more upstream. I don't mean that you need to change 
X.h, that's obviously not practical. But, maybe whomever includes X.h should be 
responsible for the #undef of any common names it may have defined. I'm 
presuming that your code does not need to directly us the things in X.h? 

So I'm wondering if the right idiom is for your plugin to say 

#include <maya/M3dView.h> 

// Clean up after X.h which may be included by the maya headers, but we don't 
use it 
#ifdef None 
#undef None 
#endif 

#include <anything else you want, without worry about None> 






On Jul 8, 2020, at 8:28 PM, Zac Coster < [ mailto:zac.cos...@rsp.com.au | 
zac.cos...@rsp.com.au ] > wrote: 

Hi oiio-devs, 

Just a small issue we found in oiio/2.1.17 that clashed with one of our 
internal Maya Plugins. 

Looks like oiio/2.1.17's typedesc.h now has an enum Flags::None 

Our MayaPlugin contains #include <maya/M3dView.h> 

which in turn seemed to bring in 
/usr/include/X11/X.h 

X.h has a pre-processor directive which is defining None as 0L 
#ifndef None 
#define None 0L 
#endif 

We've fixed this in our pipeline by patching oiio/2.1.17's typedesc.h with 
#if defined(None) 
#undef None 
#endif 

Not sure if there is a better solution. 

Many Thanks, 
zac coster 
software developer | [ mailto:zac.cos...@rsp.com.au | zac.cos...@rsp.com.au ] 
rising sun pictures | [ http://www.rsp.com.au/ | http://www.rsp.com.au ] 
+61 8 8400 6400 | mobile +61 (0)412 709 247 
_______________________________________________ 
Oiio-dev mailing list 
[ mailto:Oiio-dev@lists.openimageio.org | Oiio-dev@lists.openimageio.org ] 
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org 




-- 
Larry Gritz 
[ mailto:l...@larrygritz.com | l...@larrygritz.com ] 





_______________________________________________ 
Oiio-dev mailing list 
Oiio-dev@lists.openimageio.org 
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org 
_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to