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

Home » Public Forums » archive » problem with call_external()
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
problem with call_external() [message #5129] Thu, 05 October 1995 00:00
chs11 is currently offline  chs11
Messages: 14
Registered: October 1995
Junior Member
I'm trying to pass a two dimensional array of floats to an ansi C function.
I can successfully pass a 1-d array, but 2-d doesn't want to work.
Here's what I'm doing (in an abbreviated form)

;; idlprogram.pro ;;
pro idlprogram
a=fltarr(400,100)
b=fltarr(8)
m=long(400)
n=long(100)
l=long(8)
;some code to put data into a and b...
dummy = call_external('cfunc.so','_cfunc',a,b,m,n,l)
end

/* CFUNC.C
*/
void cfunc(int argc, void **argv)
{
float ** a;
float * b;
int m,n,l;

a = (float **) argv[0]; /* this doesn't work */
b = (float *) argv[1]; /* this works */
m = *(int *) argv[2];
n = *(int *) argv[3];
l = *(int *) argv[4];

/* code to printf a and b to stdout */
/* code to do something with a and b */
}

I'm running this on a sun4 as follows...
$ acc -fast -pic -c cfunc.c
$ ld -o cfunc.so -assert pure-text cfunc.o (and a custom library).a
$ idl
IDL> idlprogram
m = 400
n = 100
l = 8
b = 0.1, 0.2, 0.3, ...
a =
memory fault(coredump)
$


If anyone can help, I would be very grateful. Please email responces
to me (chs11@columbia.edu) and I will post a solution when one is found.
I appologize if this is a faq, but I don't know where to find the faq.

Carl
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Color Plots and Grey-scale Images
Next Topic: Re: Widget layout in BASE to get table in IDL 4.0

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

Current Time: Wed Oct 08 17:38:43 PDT 2025

Total time taken to generate the page: 0.00400 seconds