Subj : Re: Project Settings: Struct Member Alignment To : netscape.public.mozilla.jseng From : John Bandhauer Date : Thu Oct 16 2003 08:19 pm 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. Brendan Eich wrote: > Izman wrote: > >> I am trying to implement the js engine into a project that must be >> compiled >> with a struct member alignment of 1 byte. The default struct member >> alignment is 8 bytes for the js projects. The original project will not >> work properly with the js engine as is. The js portion of the original >> project works ok when I change the struct member alignment to 8 bytes >> (matching the js engine) but then other parts of the project do not >> function >> properly. This issue has occurred with all versions of the js engine >> I have >> downloaded (including the current one). My questions are: >> >> Will the js projects compile and function normally if I change the js >> project settings to a struct member alignment of 1 byte? >> > > I don't know. You'd have to test. I would be interested in your > results, but you will have to be willing to debug, give crash stack > traces, etc. > >> If I cannot change >> the struct member alignment of the js projects to 1 byte, is there a >> proper >> method of implementing the engine into a project that must be compiled >> with >> a struct member alignment of 1 byte and what is that method? >> >> > > I have non-specific memories of people doing that (on Mac OS 9 or older, > with CodeWarrior). Anyone else? > > /be > >> Thank you in advance for any help that is provided. >> >> Izman >> >> >> >> > .