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

Home » Public Forums » archive » Scalar passing with call_external
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Scalar passing with call_external [message #59362] Thu, 20 March 2008 12:48 Go to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
All,

I am having a heck of a time with something here. I am trying to
understand the behavior of a C routine that I am trying to call from
IDL.

Given this C code: (ctest.c)
void ctest ( float a, float b, float *c, float v[3] )
{
float tmp;
tmp = a*b;
v[0] = tmp;
v[1] = a-b;
v[2] = a+b;
*c = 66;
}

And this IDL code: (ctest.pro)
make_dll, 'ctest', 'ctest', 'ctest', compile_directory = '.'
a = 5.
b = 3.
c = [7.]
v = fltarr(3)
ans = call_external('ctest.so', 'ctest', a, b, c, v, /auto_glue, value
= [1, 1, 0, 0])
print, ans, a, b, c, v
end

I expect the output to be:
<undetermined> 5.0 3.0 66.0
15.0 2.0 8.0

But instead I get:
IDL> .run ctest
-1073774376 5.00000 3.00000 7.00000
15.0000 2.00000 8.00000

So the root of the question is how do I pass scalar information back
out of the C routine to the IDL? As that looks to be failing. Anyone
have any useful tips here?

Cheers,

Brian

------------------------------------------------------------ --------------
Brian Larsen
Boston University
Center for Space Physics
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Why different behaviors of Polar_Contour and Contour?
Next Topic: Re: problem with subset one image by another

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

Current Time: Sat Oct 11 01:05:51 PDT 2025

Total time taken to generate the page: 1.52312 seconds