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

Home » Public Forums » archive » Re: IDL call_external to sprlib ?
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
Re: IDL call_external to sprlib ? [message #3895] Fri, 31 March 1995 00:00
Frank J. �ynes is currently offline  Frank J. �ynes
Messages: 17
Registered: February 1995
Junior Member
zweimuel@fcggsg03 (Zweimueller Karl) wrote:
>
> I would like to include a C-library into a IDL-program via the call_external
> function. The sprlib is a library which does a lot of classification tasks,
> which I need and I would like to visualize the results in IDL.
> Now to the problem:

[cut cut cut]

> it gets memory for a vector (malloc_sample()).

Is this vector something IDL is aware of ?
I think (please someone correct me if I'm wrong) you cannot
allocate memory in any external routines for later use by IDL.
IDL needs to take care of allocation itself, that is - if
you want the external object to fill a vector with some
useful data, you need to create a vector in idl and use it as
a parameter in call_external. The return value from call_external
can only be a scalar.
The obvious disadvantage (one of them!) by this is that
you need to know the size of the vector, or at least the
largest possible size of it, before doing the call_external()

i.e. : a silly call_external representation of indgen()
IDL> dim=20L
IDL> a=intarr(dim) ;IDL allocates mem for the resultin array
IDL> res=call_external('mylib.so', 'indgen', dim, a)

int indgen(int argc, void *argv[])
{
int nelem;
short int i, *vector;

nelem = *(int *)argv[0];
vector = (short int *)argv[1];
for(i=0; i<nelem;i++)
vector[i] = i;
return (1);
}

> Any help is welcome.
> BTW, I have read the docs in .../misc/dynamic_link and chapter 18 of the
> user-documentation.
>
> Hoping for help, Charly
>
> --
> Internet: | Zweimueller Karl | Packet-Radio:
> zweimuel@icg.tu-graz.ac.at | Graz,Austria | OE5KZN@DB0LNA.DEU.EU


Besides, I think IDL's memory management needs a complete
rewrite!

Frank
--
Frank J. �ynes frank@spacetec.no
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: [Q] NR_DFPMIN: Roundoff problem in lnsrch..
Next Topic: [Q}:Rubberbanding in IDL

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

Current Time: Thu Oct 09 07:21:42 PDT 2025

Total time taken to generate the page: 0.56083 seconds