CALL_EXTERNAL simple problem ? [message #27926] |
Wed, 14 November 2001 04:41  |
the_cacc
Messages: 104 Registered: October 2001
|
Senior Member |
|
|
Hi,
OK - I've finally bitten the bullet and am calling C from IDL. So far,
it hurts a lot. I have the following simple code which gives a seg.
fault and I'm really hoping someone can help !
C code
------
void test(float f[])
{
f[0]=0.0;
}
IDL code
--------
PRO test
f=[1.0,1.0]
s=call_external('image.so','test',f)
PRINT,f
END
The C code compiles alright using the same flags as in the
CALL_EXTERNAL examples, which incidentaly work fine. I'm using IDL5.4
under Linux on Alpha.
Thanks,
Ciao.
|
|
|
Re: CALL_EXTERNAL simple problem ? [message #28040 is a reply to message #27926] |
Fri, 16 November 2001 07:27  |
the_cacc
Messages: 104 Registered: October 2001
|
Senior Member |
|
|
> ...all of the examples I can find in chapter 7 of the IDL 5.3
> External Development Guide (EDG) show the C routines to have the form:
>
> function_name (int argc, void* argv[])
>
The IDL 5.0 advanced development guide p.57 was what stumped me (yeah,
old manual but the only one I had). It has a beautiful sum_array
program that accepts arguments directly rather than by the command
line type interface so I just assumed this was OK.
Now with *the knowledge* I notice that all other examples are in
(argc,argv) form and a sentence on p.49 telling me that "Any routines
called by CALL_EXTERNAL should be defined with a prototype similar
to...[ the (argc,argv) format ]." Note "should" rather than "MUST AT
ALL COSTS AND WITHOUT FAIL" and "similar to" rather than "EXACTLY,
COMPLETELY IDENTICAL TO" !!
Ciao.
|
|
|