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 #27838 is a reply to message #27675] Tue, 06 November 2001 08:28 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Nigel Wade <nmw@ion.le.ac.uk> writes:

> 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?

I spoke too soon. I didn't remember ImportArray having a "release"
argument. I stand corrected.


>> 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. ;-)

Humor noted :-). That may be true, but data manipulation is one thing
that is easy to do in IDL itself. From experience I know that
populating IDL structures within a DLM can be very tricky indeed,
especially, as you mentioned, when there are complex data (i.e.,
strings) encapsulated within the structure.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[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: Thu Oct 23 00:22:50 PDT 2025

Total time taken to generate the page: 0.00331 seconds