[call_external] how to use it ? [message #28479] |
Wed, 12 December 2001 06:51 |
Richard Hitier
Messages: 2 Registered: December 2001
|
Junior Member |
|
|
Hi there,
I've been trying to use this fonctionality for hours now,
but... couldn't succeed :(
1st: the manual example doesn't work for me
the array pointer doesn't point to the good values.
(getting very high values ...)
2nd: in my own example it seems that I have to use long
interger in idle to be able to use (int) in the C code.
I'm trying to modify an array throug C routine, but
couldn't:
working with the array pointer doesn't seem to alter the
idl array at all.
I'm working on a Solaris station,
using gcc compiler.
There are the files:
---------------test.c-----------------------------
int function(int argc, void *argv[])
{
int s=0,*ip;
int i;
for (i=0, ip=(int*)argv[0]; i<*(int*)argv[1]; i++, ip++)
{
s+=*ip;
printf("i:%d ip:%f \n",i,*ip);
}
return(s);
}
--------------------------------------------------
---------------test.pro---------------------------
pro none, zize
tab = indgen(zize)
machin=10
print, "d'abord"
print, tab
i=call_external('none.so', 'function', tab, n_elements(tab))
print, "ensuite", i
print, tab
end
--------------------------------------------------
----------------Makefile--------------------------
.SUFFIXES:
.SUFFIXES: .c .so
.c.so:
gcc -g -fPIC $< -shared -o $@
--------------------------------------------------
By the way, does any one knows about calling an idl
procedure on unix command line as any other unix exe ?
I mean gently passing the args via command line ?
Thanks
--
richard Hitier
|
|
|