This really sounds wrong. You cannot guarantee that a MYFLT can hold a CS_TYPE* (Think 64but architecture with floats) This kind of laying is an invitation to problems as Felipe said. Can we do this cleanly? Still asleep so have not looked at what you are attempting =John Quoting Steven Yi : > Hi Felipe, > > Yes this is turning out to be a very interesting problem that I had > not expected. :) I think the solution may be to use MYFLT in the > CS_MEM_VAR to store the value of the pointer. It should make the > pointer arithmetic work to read from the memBlock member and go back > one MYFLT in space, then use as a CS_TYPE*. I think that should work > cross-platform/compiler. > > I'll be working on this tomorrow morning. Hopefully works out! > > steven > > On Fri, Jul 18, 2014 at 10:16 PM, Felipe Sateler wrote: >> >> On 18 Jul 2014 19:57, "Steven Yi" wrote: >>> >>> Update: I think I've found the root cause, but will need to take a >>> little more time to sort it out. What I'm finding is that with OSX >>> and clang, the sizeof(CS_VAR_MEM) is reporting as 12 (as it should be, >>> as sizeof(CS_TYPE*) = 4, and sizeof(MYFLT) = 8). However, on Windows, >>> gcc is giving a sizeof(CS_VAR_MEM) = 16. >> >> It need not be so. Compilers and architectures differ on alignment >> requirements, so there is no guarantee that a field after a 4 byte field >> will be 4 bytes after it. >> >> There are a few gcc attributes that control the packing of the structs, but >> I hear that playing with those should only be done Knowing What You Are >> Doing (tm), otherwise behavior is undefined. >> >> Liblo did some tricks like these and ended up not working on some >> architectures in debian. >> >> Saludos >> >> >> ------------------------------------------------------------------------------ >> Want fast and easy access to all the code in your enterprise? Index and >> search up to 200,000 lines of code with a free copy of Black Duck >> Code Sight - the same software that powers the world's largest code >> search on Ohloh, the Black Duck Open Hub! Try it now. >> http://p.sf.net/sfu/bds >> _______________________________________________ >> Csound-devel mailing list >> Csound-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/csound-devel >> > > ------------------------------------------------------------------------------ > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight - the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net