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

Home » Public Forums » archive » desallocate an array of double passed by a library
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
desallocate an array of double passed by a library [message #48848] Wed, 31 May 2006 00:26 Go to next message
Julien[1] is currently offline  Julien[1]
Messages: 3
Registered: May 2006
Junior Member
Hello,

I'd like to know if it's possible to desallocate by IDL an variable
created by an C dynamic librarie.

thank of advance,

J .Fallou
Re: desallocate an array of double passed by a library [message #48938 is a reply to message #48848] Wed, 31 May 2006 16:04 Go to previous message
codepod is currently offline  codepod
Messages: 19
Registered: March 2006
Junior Member
The method to use will depend on the type of dynamic memory being used.


If you have a library that is allocating memory for you, you will want
to use the IDL_ImportArray() function. You can provide a C function
pointer to IDL_ImportArray() and IDL will call this when it's no longer
using the imported memory. This allows you to use the appropriate
deallocation method (free, delete, ...etc) for the imported memory.

If you want IDL to allocate the memory for an array and return the
variable to the to the interpreter, you can use IDL_MakeTempArray().
Note the variable this creates is a temporary variable and it must be a
return value from the function or copied into a passed in variable
using IDL_VarCopy() For more information consult the External
Development Guide. It's a PDF that ships with IDL.

The function IDL_GetScratch() is intended to create interpreter safe
memory (temporary memory) for use within a system (C) routine, but not
to return the created variable to the caller of the routine. While
returning scratch memory will probably not cause an error if the
variable flags are set correct, it's recommended to use the above array
creation routines which verify the correct size and structure of the
allocated memory as well as set the appropriate flags.

Cheers,
-CP


J. Fallou wrote:
> kuyper@wizard.net wrote:
>> Julien wrote:
>>> Hello,
>>>
>>> I'd like to know if it's possible to desallocate by IDL an variable
>>> created by an C dynamic librarie.
>>>
>>> thank of advance,
>>>
>>> J .Fallou
>>
>> I'm no expert; I've been waiting for the experts to chime in on this
>> one, but so far I've seen no responses.
>>
>> I believe that if you use the C routines provided by IDL to create IDL
>> variables, such as IDL_MakeStruct() and IDL_StrStore() and
>> IDL_GetScratch(), that those variables can be deallocated within the
>> calling IDL code just like any other variable.
>
> Ok thanks, I try IDL_GetScratch() tomorrow.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDLffDICOMEx
Next Topic: Using Event Handlers to Change GUI Configuration

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

Current Time: Fri Oct 10 05:45:39 PDT 2025

Total time taken to generate the page: 1.20244 seconds