Problem addressing arrays from C routines running OSF [message #5657] |
Tue, 30 January 1996 00:00  |
Stubbe Faurschou Hvii
Messages: 2 Registered: January 1996
|
Junior Member |
|
|
I am writing a program which have to access some routines writen
i C. These routines
have the form somewhat like this:
---- C -----
int routine(int argc, void *argv[])
{
short *ptr = (short *)argv[0];
// do som operations on the array addressed using <ptr>
return TRUE;
}
---- IDL -----
; array = intarr(512, 512);
function routine, array
return, call_external('routine.so', 'routine', array)
end
This method of addressing an array works under Solaris, SGI Irix
and Windows
but not under OSF/1 on a DEC alpha workstation.
I think that the problem is that IDL tries to send a 32 bit
pointer, and the
C program expects a 64 bit pointer ( a good way to create chaos
:-) )
Any suggestions on how to solve this problem?
------------------------------------------------------------ ----
----------------
SSSSS FFFFFFFF HH HH Stubbe
Faurschou Hviid
SSSSSSS FFFFFFFF HH HH University of
Copenhagen
SSS FF HH HH Niels Bohr
Institute
SSS FFFFF HHHHHHHH
Universitetsparken 5
SSS FFFFF HHHHHHHH DK-2100
Copenhagen O
SSSSSSS FF HH HH
SSSSS FF HH HH Email:
stubbe@fys.ku.dk
|
|
|
Re: Problem addressing arrays from C routines running OSF [message #5738 is a reply to message #5657] |
Thu, 01 February 1996 00:00  |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
Stubbe Faurschou Hviid <stubbe@fys.ku.dk> writes:
(stuff deleted)
> This method of addressing an array works under Solaris, SGI Irix
> and Windows
> but not under OSF/1 on a DEC alpha workstation.
> I think that the problem is that IDL tries to send a 32 bit
> pointer, and the
> C program expects a 64 bit pointer ( a good way to create chaos
> :-) )
I have successfully used CALL_EXTERNAL to C programs with IDL 3.6 under OSF/1.
I don't know enough about C programming to tell you why your program didn't
work, but you can find some examples in
http://sohowww.nascom.nasa.gov/softops/cds/external/
(You can also ftp to sohoftp.nascom.nasa.gov and look in the directory
/softops/cds/external.)
Maybe the problem is in the way you compile the routine. You'll notice that I
have different Makefiles for OSF and SunOS.
Bill Thompson
|
|
|