Julien Galand wrote:
[...]
> Hi Mathias,
>
> I have followed your advice. Doing so enabled me to
investigate further,
> and I have concluded that there is definitely an
alignment weakness in
> the UNO C++ headers.
>
> The point is that I compile my add-on with alignment 2.
I thought there
> would be no problem since all UNO structures are
wrapped with :
> #pragma pack(8)
> struct { ... }
> #pragma pack()
Even though some of the structs/classes in the UNO API
(notably all the
structs generated by cppumaker) are wrapped in #pragma
pack(8), not all
are (as you noted, com::sun::star::uno::Reference for
example is not
wrapped). It cannot be recommended to compile code that
interacts with
the UNO API with compiler switches different from those of
the SDK
(which uses the default packing, equivalent to /Zp8).
(I do not know the reason for the---somewhat
redundant---#pragma pack(8)
in the cppumaker generated code. Maybe there are historical
reasons;
maybe jsc or dbo know.)
[...]
> Consequence :
> The awt::KeyEvent structure doesn't match the one of
UNO in a C++
> component compiled with such an option.
>
> As a conclusion :
> - Either compile a C++ UNO component with the alignment
compiler option
> set to 8 (or at least all SDK/UNO headers).
Yes, that is what (implicitly) is required when accessing
the UNO API.
-Stephan
> - Or the Reference<> template structure
definition should be wrapped
> with #pragma align(8).
>
> But the latter option is a fix in the SDK. Should I
report this to
> someone ?
> Or should I forward this mail to another dedicated list
?
>
> Julien Galand
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|