comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Passing Data Through CALL_EXTERNAL
items: Re: Passing Data Through CALL_EXTERNAL

Passing Data Through CALL_EXTERNAL
type: item
description: I'm having problems passing a 2-D array to a C routine using IDL's CALL_EXTERNAL procedure. Everything works fine passing scalars and 1-D arrays but when I pass a 2 dimensional float array, I can not seem to find the data in the second row of the array. I wrote some test code: TEST.PRO: nx = long(2) & ny = long(2) arr = findgen(nx,ny) a = call_external('test.so', '_test', arr, nx, ny) end TEST.C: long junk(argc, argv) int argc; void *argv[]; { long *nx, *ny; float **arr; /* Assign passed in arguments */ arr = (float **) argv[0]; /* array */ nx = (long *) argv[1]; /* X dimensions of array */ ny = (long *) argv[2]; /* Y dimensions of array */ printf("Arr[][]...); /* prints: 0, 1, 0, 0 */ } Unfortunately the IDL documentation does not address 2-D array. I'm using IDL version 3.6.1 on Sun OS 4.1.3. Any suggestions as to what I am doing wrong? Thanks, -- ( . (. ) ) ) ( ( David Kendig (Hughes STX) .________. Operations Manager EGRET/Gamma Ray Observatory | | __| Code 664, GSFC/NASA | )) Greenbelt, MD 20771 | | //| (301) 286-7242 `---`-`------'---' Coffee coffee ... djk@egretop.gsfc.nasa.gov
creator: djk
date: 1995-03-17T20:59:03-00:00

Re: Passing Data Through CALL_EXTERNAL
type: item
description: This is just a follow up to my question concerning passing multi-dimension arrays using call_external. First I want to thank all those who responded. The answer is rather simple. One just passes the multi-dimensioned array as a simple array. Using the example from my original post: long junk(argc, argv) int argc; void *argv[]; { long *nx, *ny; float *arr; /* Assign passed in arguments */ arr = (float **) argv[0]; /* array */ nx = (long *) argv[1]; /* X dimensions of array */ ny = (long *) argv[2]; /* Y dimensions of array */ z = arr[ix + iy * nx]; } Thanks again for all the help! -- ( . (. ) ) ) ( ( David Kendig (Hughes STX) .________. Operations Manager EGRET/Gamma Ray Observatory | | __| Code 664, GSFC/NASA | )) Greenbelt, MD 20771 | | //| (301) 286-7242 `---`-`------'---' Coffee coffee ... djk@egretop.gsfc.nasa.gov
creator: djk
date: 1995-03-22T14:40:39-00:00