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

Home » Public Forums » archive » Allocating memory in LINKIMAGE program
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: Allocating memory in LINKIMAGE program [message #20761 is a reply to message #20680] Thu, 20 July 2000 00:00 Go to previous messageGo to previous message
Randall Frank is currently offline  Randall Frank
Messages: 17
Registered: October 1999
Junior Member
Virginia,
You can use something like this to return an array of (n)
strings:

s = (IDL_STRING *)IDL_MakeTempVector(IDL_TYP_STRING,
n, IDL_BARR_INI_ZERO, &vpTmp);
for(i=0;i<n;i++) IDL_StrStore(s++,YourCStringArray[i]);
IDL_VarCopy(vpTmp,argv[0]);

In general, do not pass memory you allocated with malloc back
to IDL, especially if you want IDL to clean it up later for you.

Hope it helps.

Virginia Rogers wrote:
>
> I have a C program which queries a database and returns a list of all matching
> entries. I am making this routine callable in IDL with LINKIMAGE. I'd like to
> return a string array to the calling IDL program. My question is, how do I
> allocate the memory to store the strings? The C program has allocated space for
> all of the strings with malloc(). Can I call IDL_MakeTempArray() to create the
> string array and then set each of the string pointers to point to the location
> allocated by malloc()? Is there another source of information about using
> LINKIMAGE other than the IDL Advanced Development Guide?
>
> Thanks! Ginny

--
rjf.
Randy Frank | ASCI Visualization
Lawrence Livermore National Laboratory | rjfrank@llnl.gov
B451 Room 2039 L-561 | Voice: (925) 423-9399
Livermore, CA 94550 | Fax: (925) 423-8704
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using IDL from a perl script
Next Topic: Lonlat2reg.pro vs. Grid program

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

Current Time: Wed Oct 08 17:32:42 PDT 2025

Total time taken to generate the page: 0.00473 seconds