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 #27816 is a reply to message #27675] Wed, 07 November 2001 02:00 Go to previous messageGo to previous message
Nigel Wade is currently offline  Nigel Wade
Messages: 286
Registered: March 1998
Senior Member
Richard Younger wrote:

> Nigel Wade wrote:
>>
>> 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?
>
> It could be that IDL handles malloc() and free() just fine, but not
> new[] and delete[], which is what K. seems to be using (though I'm not
> sure about delete[]). I am not at all familiar with how new[] is
> implemented, but it could use malloc() or include garbage collection, or
> be radically different. From what I remember, I don't think it's in the
> C++ spec and so would depend on your compiler.
>

Could be. I'm a C programmer (mostly) and used to using malloc/free, so no
garbage collection, constructors or destructors to worry about.

I quite happily malloc memory, and use ImportArray to add it to an IDL
variable. Then free it in the callback when the IDL variable is destroyed.
I'm more comfortable with doing the clean up for myself - I'm never
convinced in Java that all the objects I create are going to get cleaned up
by the GC.

--
-----------------------------------------------------------
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: Sat Oct 11 10:40:25 PDT 2025

Total time taken to generate the page: 1.29230 seconds