From: Francis Cianfrocca Date: 2007-06-25T20:04:25+09:00 Subject: Re: Name clash in C extension ------=_Part_23126_30958079.1182769465966 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 6/25/07, Alex Gutteridge wrote: > > Hi, > > I'm trying to write an extension interfacing with the C iGraph > library (http://cneurocvs.rmki.kfki.hu/igraph/). Unfortunately the > iGraph header files define a macro called TYPE which clashes with the > TYPE macro defined in ruby.h. Both headers are obviously required to > compile my extension. What happens if you define a wrapper for the calls you make to the IGraph liibrary? That way you include only the wrapper's header in the extension's main source file (the one that includes ruby.h and defines Init_xxx). You'll have to massage all data items between Ruby-land and C in the wrapper as well. I took this approach in the EventMachine library (where it has an additional benefit because the wrapper is in C, but the extension code is all in C++, so the wrapper approach avoids exposing decorated symbols in the compiled extension). ------=_Part_23126_30958079.1182769465966--