Mail Archives: cygwin/1999/04/16/02:21:26
Using C it is fairly easy to use DirectX with gcc.
But most of the samples from MS are in C++. It is possible
to compile those samples using gcc (I use EGCS 1.1.2), but the
executable program breaks down. This is due to the fact that
the layout of COM objects (structs with pure virtual members) in gcc
differs from that supposed by MS. This has been mentioned in this
list before by Mumit Khan.
By inspection one finds the following layout for
struct Obj {
virtual A(...) = 0;
virtual B(...) = 0;
....
}
MS gcc
== ===
address A (4 bytes) 8 bytes
address B (4 bytes) DA (4 bytes) address A (4 bytes)
... DB (4 bytes) address B (4 bytes)
...
and DA etc has be 0 to get the code produced by gcc to behave as
expected by MS.
One possible solution then would be to create a copy of the MS object
with a layout adapted to gcc. This means rather few changes in the
but not in all. I suspect that there might be more to an object than
is seen in the interface declaration, i e there are more things to
copy.
Questions:
1) Any help?
2) Is there or will there be a compiler flag in gcc which brings
about the "correct" code for MS COM objects?
I don't intend do to do any serious work with DirectX. However it is
there and I want to climb it by curiousness.
Magnus Bondesson
Department of Computing Science
Chalmers University of Technology
S-412 96 Gothenburg
SWEDEN
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -