comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » C Alignment/IDL structures
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
C Alignment/IDL structures [message #43098] Wed, 16 March 2005 08:13 Go to previous message
joey is currently offline  joey
Messages: 5
Registered: March 2005
Junior Member
Hi! I have an C library which I link into IDL using IDL_MakeStruct. The
structure I link in with IDL is not a true C structure, but a dynamic
structure I create on the fly depending on the data I wish to have within
IDL.

It works quite well; however, one of the elements incorporated in my
structure is another structure which I would like to add a double value.

When I add this double, my structure size seems to get the wrong size for
IDL to handle so nothing will work when accessing the structure. I compute
the size to a value which is the sum of all bytes in the structure which
obviously does not take into account the packing/aligning that C does.

My question is: is there a way I can figure out how many bytes to malloc
such that IDL and I will always be in agreement?

Even if we are in agreement, I need to know where the padding will occur so
I would like to have the same algorithm that IDL uses to compute its
structure allocation when given a list of tags.

If I stick to floats/long/int/etc/strings/etc. everything seems to work
great. Its only when adding the double that everything goes bad.

Thanks for any advice!

Joey
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Compile or not compile?
Next Topic: Re: Converting INT to STRING out of space...

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:23:04 PDT 2025

Total time taken to generate the page: 0.00425 seconds