[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building sharable object libraries for CALL_EXTERNAL



I don't think this is true.  Functions like IDL_MakeStruct(),
IDL_ImportArray() and IDL_ImportNamedArray(),
are handy for building IDL variables with memory you allocate.

However, the following code will most likely not produce the desired
results.  Reading the External Development Guide is a recommended first
step, especially the chapter on IDL Internals: Variables.

> output=(float **)malloc(4*n);
>  for(i=0;i<n;i++) output[i]=(float*)malloc(4*x*y);


Scott


>
> I thought it was a no-no to allocate memory inside of an external
> routine, that is to be passed back to IDL. The Advanced Developer's
> Guide has always stated that all memory must be allocated prior to
> calling the routine. Is that not always the case?
>
> Even if you get this to compile, I would be very wary of the results.
>
> Dave
> --
>
>   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     David S. Foster         Univ. of California, San Diego
>      Programmer/Analyst     Brain Image Analysis Laboratory
>      foster@bial1.ucsd.edu  Department of Psychiatry
>      (619) 622-5892         8950 Via La Jolla Drive, Suite 2240
>                             La Jolla, CA  92037
>   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~