gcc version mismatches

Mike Alexander mta at umich.edu
Fri Nov 18 23:07:35 PST 2011


--On November 18, 2011 2:17:26 AM -0800 Kyle Husmann 
<kyle.husmann at gmail.com> wrote:

> On Thu, Nov 17, 2011 at 4:02 AM, Keith J. Schultz
> <keithjschultz at web.de> wrote:
>> Just good programming practices and experience.
>
> On Thu, Nov 17, 2011 at 6:41 PM, Mike
> Alexander <mta at umich.edu> wrote:
>> I learned what I know about it from experience and talking to other
>> developers.
>
> Are there some simple rules of thumb I can follow then?

I gave some general ideas in a previous message in this thread: "You 
have to be careful that objects don't leak out of one library (compiled 
with compiler X) into another library (compiled with compiler Y).  I 
suspect this isn't a problem with most libraries in MacPorts since the 
APIs have been designed to avoid problems like this, but it could 
happen. As long as any object created by a given library is treated as 
an opaque pointer outside that library, you're probably ok."

In general make sure that everything that accesses a given object is 
compiled by the same compiler and that everything else treats the 
object pointer as an opaque pointer.  Even in C code you can sometimes 
get in trouble if one library allocates something and a different 
library releases it, depending on exactly how you do the allocation and 
release.

     Mike
 


More information about the macports-users mailing list