Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Idl-pvware > call_external w...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 5428 of 5995
Post > Topic >>

call_external with auto_glue

by jingdaniel2007@[EMAIL PROTECTED] Feb 13, 2008 at 12:18 PM

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'
    ex****t_rtns = 'slaCs2c'
    MAKE_DLL, source, 'call_external_examples', ex****t_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_glue)

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 !
 




 1 Posts in Topic:
call_external with auto_glue
jingdaniel2007@[EMAIL PRO  2008-02-13 12:18:25 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 18 20:39:02 CDT 2008.