External c calls broken in IDL 5.5 [message #32012] |
Tue, 03 September 2002 13:52 |
Bob[1]
Messages: 7 Registered: September 2002
|
Junior Member |
|
|
I have some dlm's that I made using DLMFORM (see
http://www.astro.uio.no/~steinhh/idl/dlmform.html). They call fortran
code through a c wrapper. They worked fine on IDL 5.3 and Tru64 Unix
5.0 but now that I've upgraded to IDL 5.5 and Tru64 Unix 5.1A they will
no longer work (they core dump). I've tried remaking them and that
doesn't help. Has anyone else had this problem?
So I've tried a really simple example (below) using call_external and
just using c code and even the simple code that follows doesn't work
(it should print out "n = 25" and "x = 3.14159"). Anyone have any
ideas.
And last, is there a newer version of dlmform. I really like this
routine but it is using some obsolete functions.
Thanks,
Bob
In test.c
#include <stdio.h>
#include "export.h"
void test(int argc, IDL_VPTR argv[])
{
IDL_LONG n = argv[0]->value.l;
printf("n = %i\n", n);
float x = argv[1]->value.f;
printf("x = %f\n", x);
}
I complile and link with:
cc -c -I/usr/local/rsi/idl/external -pthread test.c
ld -S -expect_unresolved '*' -shared -all -hidden -o test.so test.o
then trying it:
$ idl
IDL Version 5.5, Compaq Tru64 (OSF alpha). (c) 2001, Research Systems,
Inc.
IDL> n = 25l
IDL> x=!PI
IDL> help,n,x
N LONG = 25
X FLOAT = 3.14159
IDL> dum = call_external('./test.so', 'test',n,x)
n = 1074012760
x = 0.000000
IDL>
|
|
|