Subj : Re: Project Settings: Struct Member Alignment To : netscape.public.mozilla.jseng From : "Izman" Date : Fri Oct 17 2003 01:25 am I tried using the #pragma pack directive and it didn't work as I had hoped (probably from a poor implementation on my part), I received the same results from the program before and after inserting the directives into the code. From reading the #pragma pack docs, it looks as though it only works when you first declare stuctures and not when you define them. I would have had to wrap all kinds of code in my functions with the pragma directive along with the includes and that would have been a pain considering there is no gaurantee all the work would have been successful, not to mention it would have been a mess to look at. On the flip side: After some preliminary results, the js engine (compiled with a struct member alignment of 1 byte) functions successfully so far. I still have alot of testing to do but I have had nice results up until this point. I'll post back here after I test some more. Izman "John Bandhauer" wrote in message news:bmnj23$421@ripley.netscape.com... > Like brendan said, it might just work if you recompile the engine with 1 > byte packing. Might not. > > However, (for the MS compiler, at least) you should be able to use > '#pragma pack' blocks around the #includes of jJS headers in your code > to tell the compiler that the JS structs expect 4 byte alignment - even > if all your other structs are packed tighter. The compiler is supposed > to be smart enough to know to do the right thing with any subsequent use > of a struct type declared with a given packing. > > Something like... > > #pragma pack(push, 4) > #include "jsapi.h" > #pragma pack(pop) > > Not that I've done that with SpiderMonkey, but I'd expect something like > that to work :) > > See: > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_predir_pack.asp > > John. > .