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

Home » Public Forums » archive » Returning A Variable Length struct to IDL from C
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: Returning A Variable Length struct to IDL from C [message #27847 is a reply to message #27675] Tue, 06 November 2001 05:36 Go to previous messageGo to previous message
Nigel Wade is currently offline  Nigel Wade
Messages: 286
Registered: March 1998
Senior Member
Craig Markwardt wrote:

>
> Greetings--
>
> K Banerjee <kbanerje2@home.com> writes:
>
>> The next two lines are used to create the return value to IDL:
>>
>> void *psDef = IDL_MakeStruct(NULL, vbHeaderTags);
>> IDL_VPTR ivReturn = IDL_ImportArray(1, ilDims, IDL_TYP_STRUCT,
>> (UCHAR *) theHeaderActual, releaseMemory, psDef);
>
> Here is your first problem. IDL_ImportArray only works when you
> import static data, not dynamically allocated. Basically ImportArray
> only works once per piece of memory per IDL session.

Really?. I run code which calls IDL_ImportArray many 1000s of times within
a session, all with malloc'd data and have not had any problems.

Why do you think it can only be used once per session, with static data?

>
>> IDL_STRUCT_TAG_DEF vbHeaderTags[] =
>> {
>> {"VERS", 0, (void *) IDL_TYP_STRING},
>> {"USERHEADER", dims_user_header, (void *) IDL_TYP_STRING},
>> {"BYTEOFFSET", 0, (void *) IDL_TYP_LONG},
>> {0}
>> };
>
> Here (in my opinion) is your second problem: trying to do something
> too complicated within a DLM function. I personally think that while
> it's not impossible, trying to manipulate complex data structures
> within a DLM are very *close* to impossible and are really
> unnecessary.

No, no, no! You're missing the entire purpose of DLMs.
It's the realm of DLMs to do those things which are too complicated to do
in IDL. ;-)



--
-----------------------------------------------------------
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523568, Fax : +44 (0)116 2523555
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Defining Integer Field in a Structure
Next Topic: Re: Color problems with 5.5/RH linux 7.1

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

Current Time: Fri Oct 10 20:58:11 PDT 2025

Total time taken to generate the page: 0.80200 seconds