realbasic-plugins
[Top] [All Lists]

Re: Structure padding ( was Windows plugin crashes on first call to met

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: Structure padding ( was Windows plugin crashes on first call to method )
From: Einhugur Software <bjorn at einhugur dot com>
Date: Thu, 25 Jul 2002 00:14:29 +0000
> I've seen this advice several times on newsgroups and in the SDK
> documentation - the question is how do you know where to pad and how much?
> Does anyone have an example?
> 

struct MyClassData
{
    REALstring someString;
    REALstring someOtherString;

    #ifndef WIN32
        RGBColor   myColor
    #else
        COLORREF   myColor
        char       padding1[2] <--- Here we needed padding because COLORREF
                                    is 4 bytes and RGBColor is 6
    #endif

    Boolean       myBoolean;
    int           myInt;
};

--  
______________________________________________________________________
Björn Eiríksson                              bjorn at einhugur dot com
Einhugur Software                            einhugur at kagi dot com
http://www.einhugur.com
______________________________________________________________________
Einhugur Software has sold its products in 39 countries world wide.
______________________________________________________________________
For support:             support at einhugur dot com
For bug reports:         bugs at einhugur dot com
To post on the maillist: einhugur at yahoogroups dot com







<Prev in Thread] Current Thread [Next in Thread>