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

Home » Public Forums » archive » call_external with auto_glue
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
call_external with auto_glue [message #58685] Wed, 13 February 2008 12:18
jingdaniel2007 is currently offline  jingdaniel2007
Messages: 1
Registered: February 2008
Junior Member
Hi,

I am learning to use call_external to call some C programs (from
slalib library) in idl. By checking the IDL help page, I found that
the keyword anto_glue can help generate the glue funtions to avoid the
argc-argv calling convention. This is helpful since I am not quite
familiar with C programming. But it didn't seem to work for me even
I tried on some simple routine like this one:

#include "slalib.h"
#include "slamac.h"
void slaCs2c ( float a, float b, float v[3] )
{
float cosb;
cosb = (float) cos ( b );
v[0] = (float) cos ( a ) * cosb;
v[1] = (float) sin ( a ) * cosb;
v[2] = (float) sin ( b );
}

I used get_callext_exlib.pro to build the sharable libary of external
C code and return the path as its result, which is from the examples
of call_external in idl (external/call_external/C) :

function get_callext_exlib
common GET_CALLEXT_EXLIB_BLK, shlib
....
source = 'cs2c'
export_rtns = 'slaCs2c'
MAKE_DLL, source, 'call_external_examples', export_rtns, $
INPUT_DIR=call_ex_dir, DLL_PATH=shlib
return, shlib
end

I am pretty sure get_callext_exlib and MAKE_DLL works since all the
examples of call_external in idl directory work for me. So I called
the C program in idl like this:

IDL> a=1. & b=2. & c=fltarr(3)
IDL> r=call_external(get_callext_exlib(),'slaCs2c',a,b,c,/auto_gl ue)

The commands ran without any problem, but I got all 0s for c. I am
very puzzled what could be wrong. I really appreciate if anyone can
help me. Thanks in advance !
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Get index from table widget
Next Topic: map projections

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

Current Time: Wed Oct 08 17:47:50 PDT 2025

Total time taken to generate the page: 0.00463 seconds