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

Home » Public Forums » archive » call C routine on a Linux computer
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
call C routine on a Linux computer [message #18841] Tue, 08 February 2000 00:00 Go to previous message
Shunrong Zhang is currently offline  Shunrong Zhang
Messages: 1
Registered: February 2000
Junior Member
Hi,

I was trying to call a simple C routine using call_external, but failed.

The C code file is sample.c (IDL 5.1 External Development Guide, p 108)


#include <stdio.h>
float sum_array(argc, argv)
int argc;
void *argv[];
{
float *fp, s = 0.0; int n;
for(n = *(int *) argv[1], fp = (float *) argv[0]; n--; )
s += *fp++;
return(s);}

I worked with a Linux computer, and the C compiler is gcc (v2.7). So I
compiled and linked in the following way,

cc -fPIC -c sample.c
ld -shared -o sample.so sample.o

Then from IDL,

X = FINDGEN(10)
S = CALL_EXTERNAL('sample.so', '_sum_array' X, N_ELEMENTS(X),
/F_VALUE)

There came out a message of syntax error.
I changed the entry point name from '_sum_array' to 'sum_array', the
same error message came out.

What was my entry point name ? Anything wrong in my above procedure ?

Thank you in advance !

S.-R.
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Passing optional parameters through a wrapper routine
Next Topic: Object recognition

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

Current Time: Fri Oct 10 01:27:18 PDT 2025

Total time taken to generate the page: 1.03781 seconds