LINKIMAGE problem (beginner) [message #11210] |
Sat, 07 March 1998 00:00 |
Reinhold Schaaf
Messages: 10 Registered: March 1998
|
Junior Member |
|
|
<HTML>
<TT>Hi there,</TT><TT></TT>
<P><TT>I want an IDL program call C subroutines. Since the CALL_EXTERNAL
mechanism seems to provide no possiblities for typechecking (?) I want
to use LINKIMAGE, where typechecking can (and must) be done. Everything
is pretty nasty (I really don't like pointers on pointers on pointers ...),
but anyway.</TT><TT></TT>
<P><TT>What I could not find out by myself is:</TT><TT></TT>
<P><TT>How can I create (in my C program) a (IDL-) scalar variable of any
type, that is set to something and returned to IDL. I tried something like:</TT><TT></TT>
<P><TT>#include "export.h"</TT>
<BR><TT>#include "Linktest.h"</TT><TT></TT>
<P><TT>IDL_VPTR margins(int argc, IDL_VPTR argv[])</TT>
<BR><TT>{</TT><TT></TT>
<P><TT> IDL_VPTR pvResult = IDL_Gettmp();</TT>
<BR><TT> pvResult = IDL_CvtDbl(1, &pvResult);</TT>
<BR><TT> return(pvResult);</TT>
<BR><TT> </TT>
<BR><TT>}</TT>
<BR><TT></TT> <TT></TT>
<P><TT>which should (in my understanding) create a temporary scalar of
type undefined, convert it to double, and return it back to IDL.</TT><TT></TT>
<P><TT>However, after linking everything in with</TT><TT></TT>
<P><TT>LINKIMAGE, 'MARGINS', 'Linktest.dll', 1, 'margins', $</TT>
<BR><TT>
MAX_ARGS=0, MIN_ARGS=0</TT><TT></TT>
<P><TT>(I am working under NT)</TT><TT></TT>
<P><TT>and calling the function with</TT><TT></TT>
<P><TT>x = margins()</TT><TT></TT>
<P><TT>IDL responds:</TT><TT></TT>
<P><TT>% MARGINS: Variable is undefined: <UNDEFINED>.</TT>
<BR><TT>% Execution halted at: $MAIN$</TT>
<BR><TT></TT> <TT></TT>
<P><TT>I tried some variants of the above, none worked.</TT><TT></TT>
<P><TT>Any help?</TT>
<BR><TT></TT> <TT></TT>
<P><TT>Thanks</TT><TT></TT>
<P><TT>Reinhold</TT><TT></TT>
<P><TT>--</TT>
<BR><TT> ************************************************************ * </TT>
<BR><TT> Reinhold Schaaf</TT>
<BR><TT> Ettighofferstr. 22</TT>
<BR><TT> 53123 Bonn</TT>
<BR><TT> Germany</TT><TT></TT>
<P><TT> Tel.: 0049-0228-625713</TT>
<BR><TT> Email: schaaf@astro.uni-bonn.de</TT>
<BR><TT> ************************************************************ * </TT>
<BR><TT><FONT SIZE=-1></FONT></TT> </HTML>
|
|
|