🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.programmer.codewarrior
Article #807

Re: Alignment (padding) of derived classes, Mach-O vs. CFM

#807
From: Stefan Haller
Date: Wed, 25 Jun 2003 19:06
25 lines
1970 bytes
Miro Jurisic <macdev@meeroh.org> wrote:

> In article <1fwrc5z.1wbucc58vha4aN%stk@snafu.de>, stk@snafu.de (Stefan Haller)
> wrote:
> 
> > We need to pass objects between a Mach-O application and a CFM shared
> > library, built from the same source code.
> 
> You are doomed.

Well, fortunately we are not.  We call virtual functions only from the
Mach-O side, and we don't use dynamic_cast on the CFM side.  With these
restrictions everything works well, except for the padding-between-base-
and-derived problem.

We were able to solve that problem by adding compile-time assertions to
make sure that the offset of the first member of every derived class is
equal to sizeof(base).  It turned out that we had to add manual padding
only in two classes (out of some 400).


-- 
Stefan Haller
Berlin, Germany
http://home.snafu.de/stk/
Technical Details
Message-ID: <1fx4n9b.yw82xo18155hpN%stk@snafu.de>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!lnsnews.lns.cornell.edu!newsstand.cit.cornell.edu!news.stealth.net news.stealth.net!news.stealth.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!news.eusc.inter.net!stk
References: <1fwrc5z.1wbucc58vha4aN%stk@snafu.de> <macdev-7428E9.22150424062003@senator-bedfellow.mit.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bcce,98e56c06675247cc
X-Google-Attributes: gid10bcce,public
X-Google-Thread: f635e,98e56c06675247cc
X-Google-Attributes: gidf635e,public
X-Google-ArrivalTime: 2003-06-25 12:06:37 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!lnsnews.lns.cornell.edu!newsstand.cit.cornell.edu!news.stealth.net news.stealth.net!news.stealth.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!news.eusc.inter.net!stk
From: stk@snafu.de (Stefan Haller)
Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac
Subject: Re: Alignment (padding) of derived classes, Mach-O vs. CFM
Date: Wed, 25 Jun 2003 21:06:14 +0200
Organization: none
Lines: 25
Message-ID: <1fx4n9b.yw82xo18155hpN%stk@snafu.de>
References: <1fwrc5z.1wbucc58vha4aN%stk@snafu.de> <macdev-7428E9.22150424062003@senator-bedfellow.mit.edu>
X-Trace: news.eusc.inter.net 1056567996 14737 213.23.144.7 (25 Jun 2003 19:06:36 GMT)
X-Complaints-To: abuse@eusc.inter.net
Mail-Copies-To: never
User-Agent: MacSOUP/2.5b3 (Mac OS X version 10.2.6)