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
Re: C Alignment/IDL structures [message #43195 is a reply to message #43098] Wed, 16 March 2005 10:07 Go to previous message
Randall  Skelton is currently offline  Randall Skelton
Messages: 31
Registered: October 2004
Member
I'm not sure I completely understand what you are doing... can you post
a snipit of code? I trust that you are passing back an unnamed
structure from C as named structures are persistent in a given session.
Hence, you should call as:

ptr = IDL_MakeStruct(NULL, mytags);

This is the reason the following fails:

IDL> a = {foo, a: 0, b: ''}
IDL> b = {foo, c: 0}
% Wrong number of tags defined for structure: FOO.

Once 'foo' is defined, you cannot change its fields.

In general, when I have to pass C structures from existing code back to
IDL I do it by creating a shadow structure (in C) that uses all the
defined IDL types and copying the data. You really cannot rely on
generic C variables having the same size as thier IDL counterparts
(take a look at the definition of IDL_ALLTYPES in idl_export.h). You
can cheat a little when initializing arrays as you can point to the
memory in your existing structures if the sizes align, but everything
in the C structure should be defined with one of the macros given in
the EDG. I don't think you should be seeing any structure alignment
issues...

Cheers,
Randall
[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 19:33:19 PDT 2025

Total time taken to generate the page: 0.00443 seconds